Write a program to display the multiplication table of the input number.
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string str = "";
int Number;
while (str != "Exit" && str != "E" && str != "exit" && str != "e")
{
Console.Write("Write a number from 1 to 9 (Or write the Exit): ");
str = Console.ReadLine();
if (int.TryParse(str, out Number))
if (Number >= 1 && Number <= 9)
for (int i = 1; i <= 9; i++)
Console.WriteLine(Number + "*" + i + "=" + Number * i);
}
}
}
}
Comments
Leave a comment