Q:

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

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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:

Enter number to print table: 

15

15 X 1 = 15 

15 X 2 = 30 

15 X 3 = 45 

15 X 4 = 60 

15 X 5 = 75 

15 X 6 = 90 

15 X 7 = 105 

15 X 8 = 120 

15 X 9 = 135 

15 X 10 = 150

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write C# program to print all natural numbers in r... >>
<< Write C# program to print ASCII values of all char...