Tuesday 4 December 2012

Printing Table using while loop


Printing Table using while loop


            //Table while loop


            Console.WriteLine("Enter a number to print table");
            int a = int.Parse(Console.ReadLine());

            Console.WriteLine("table of " + a + " is");

            int i = a;
            while (i <= a * 10)
            {

                Console.WriteLine(i);
                i = i + a;
            }
            Console.ReadLine();

No comments:

Post a Comment