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

 #Day 2 :Reverse Numerical Triangle with Decrementing Start


Welcome to Day 2 of our "101 Days Pyramid Pattern in C# .NET" tutorial series. Today, we'll focus on creating a decrementing pyramid pattern, a useful exercise for understanding nested loops in C# programming. This pattern starts with a specified number and decreases with each column in the rows, like so:

5
54
543
5432
54321

Source Code :

using System;
namespace Pyramid
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = 1;

            for(int i=5;i>=1;i--)
            {
                for(int j=5;j>=i;j--)
                {
                    Console.Write(j);
                }
                Console.WriteLine();
            }
            Console.Read();
        }
    }
}
 


OutPut :



1 comment: