Search This Blog

Saturday, 12 September 2015

Pyramid program in C# (Type 1)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 5; i++)
            {
                Console.WriteLine("");
                for (int j = 1; j <= i; j++)
                {
                    Console.Write("*");
                }
            }
            Console.ReadKey();
        }
    }

}

Output:

*
**
***
****
*****

No comments:

Post a Comment