#Day 4 :101 Days Pyramid Pattern in C# .NET

 #Day 4: Exploring Number Pyramids in C#.NET

Today’s pattern is an interesting descending sequence pyramid in C#. 


Each row starts with a different digit and increments sequentially up to 5.

 This type of exercise helps in understanding nested loops and number manipulation in programming.

45 
345 
2345 
12345

Source Code:


using System;

namespace Pyramid

{

    internal class Program

    {

        static void Main(string[] args)

        {

            int n = 5;

           for(int i = n; i >= 1; i--)

            {

                for(int j=i;j<=n;j++)

                {

                    Console.Write(j);

                }

                Console.WriteLine();

            }

            Console.Read();

        }

    }

}


OutPut:


No comments:

Post a Comment