Showing posts with label program to print following output using for loop.. Show all posts
Showing posts with label program to print following output using for loop.. Show all posts

Tuesday, September 2, 2014

program to print following output using for loop.

using System;
namespace Example2
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, j;
            i = 0;
            j = 0;

            for (i = 1; i <= 5; i++)
            {
                for (j = 1; j <= i; j++)
                {
                    Console.Write(i);
                }
                Console.Write("\n");
            }
            Console.ReadLine();
        }
    }
}


O/P:

1
22
333
4444
55555