Wednesday, February 16, 2011

Mathematical Table

Mathematical Table
Lets make a Program that take input and will show mathematical table.



static void Main(string[] args)
        {
            int table;            
            Console.WriteLine("Enter Table Number");
            table = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i < 13; i++)
            {
                Console.WriteLine(table + " x " + i + " = " + i * table); 
            }
            Console.ReadKey();   
        }


Lets make another program that will show mathematical table from 1 to 12.



static void Main(string[] args)
        {
            for (int i = 1; i < 11; i++)
                for (int j = 1; j < 13; j++)
                    Console.WriteLine(i + " x " + j + " = " + i * j);
            
            Console.ReadKey();   
        }

No comments:

Post a Comment