Write C# program to print multiplication table of a given number

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
public class csharpExercise
{
    static void Main(string[] args)
    {
 
        int i, num;
 
        //Reading number
        Console.WriteLine("Enter number to print table: ");
        num = Convert.ToInt32(Console.ReadLine());        
 
        for (i = 1; i <= 10; i++)
        {
            //Printing table of number entered by user            
            Console.Write("{0} X {1} = {2} \n", num, i, num * i);            
        }
        Console.ReadLine();
    }
}

Result

Write C# program to print multiplication table of a given number
Write C# program to print multiplication table of a given number

Leave a Comment

x