using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Loop_Examples1
{
class Program
{
static void Main(string[] args)
{
int n1, n2;
Console.Write("Enter table number upto which u want to generate : ");
n1 = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= n1; i++)
{
Console.WriteLine("\n");
for (int j = 1; j <= 10; j++)
{
n2 = i * j;
Console.WriteLine("{0} * {1} = {2}", i, j, n2);
}
Console.ReadLine();
}
}
}
}
Sample Output
If you want to display table from 1 to 10 just enter 10 after that you get table from 1 to 10. You can get any range like 20,40,100 just enter number and get table.
No comments:
Post a Comment