Programming Course in C# ¡Free!

Multiplication table

 Sunday, March 31, 2013 published by Exercises C#
Proposed exercise

Write a C# program to ask the user for a number and display its multiplication table, like this: 

5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
...
5 x 10 = 50



Output



Solution


using System;
public class MultiplicationTable
{
public static void Main()
{
Console.WriteLine("Enter a number:");
int x = Convert.ToInt32(Console.ReadLine() );

for (int i=0; i <= 10;i++)
Console.WriteLine("{0} x {1} = {2}", x, i, x*i); 
}
}