Multiplication table (use while) Learn programming C# Sharp

Lesson:

Flow Control


Exercise:

Multiplication table (use while) 49


Objetive:

Write a C# program to ask the user for a number and display its multiplication table, using a "while"


Code:

using System;
'Multiplication table
public class Exercise23
{
    public static void Main()
    {
        int num, multiplier = 1;

        Console.Write("Insert a number to multiply: ");
        num = Convert.ToInt32(Console.ReadLine());

        while (multiplier <= 10)
        {
            Console.WriteLine("{0} x {1} = {2}",
                num, multiplier, num * multiplier);
            multiplier++;
        }
    }
}