Monday, December 17, 2012

PROGRAM TO GENERATE THE TABLE OF A GIVEN NUMBER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
class Table
{
static void Main(string[] args)
{
int no, i, temp;
Console.Write("Please Enter a number: ");
String strNo = Console.ReadLine();
no = int.Parse(strNo);
i = 1;
while (i <= 10)
{
temp = i * no;
Console.WriteLine(""+no+" x "+i+" = "+temp);
i++;
}
Console.ReadLine();
}
}
}

/*--------------Output-----------------------------------*/

Please Enter a number: 56

56 x 1 = 56

56 x 2 = 112

56 x 3 = 168

56 x 4 = 224

56 x 5 = 280

56 x 6 = 336

56 x 7 = 392

56 x 8 = 448

56 x 9 = 504

56 x 10 = 560





No comments:

Post a Comment