Write Pyramid in c#

By Kailash Chandra Behera Mar 30, 2013
This code describes how to write pyramid using c#
class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the lenth of pyramid");
            int l = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <= l; i++)
            {
                for (int j = 1; j <= l - i; j++)
                {
                    Console.Write(" ");
                }
                for (int j = 1; j <= 2 * i - 1; j++)
                {
                    Console.Write("*");
                }
                Console.WriteLine(" ");
            }
            Console.Read();
        }
    }
Kailash Chandra Behera

I am Kailash Chandra Behera Working as Sr. Developer  in Software Sector, I have   two times been awarded as MVP From C# Corner(2013,2014). Currently  Working in L7 software Pvt. Ltd. in live Tra... Read more

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs