Learn to Create a 101 Days Pyramid Pattern in C# .NET

 #Day 1: Introduction to the 101 Days Pyramid Pattern in C# .NET and  1st  Pyramid Pattern.


 Description

          Welcome to Day 1 of our 101 Days Pyramid Pattern tutorial in C# .NET. Today, we will focus on understanding what a pyramid pattern is and how we can generate one using C#. Pyramid patterns are a common programming exercise that helps in understanding nested loops and control structures.

What is a Pyramid Pattern?

A pyramid pattern is a series of numbers arranged in a way that forms a pyramid-like structure. For example, a small pyramid pattern with the first 10 days might look like this:

1
2 3
4 5 6
7 8 9 10

Each row of the pyramid contains consecutive numbers, and the number of elements in each row increases as you move down the pyramid.


Now, We Will Learn 1st Day And 1st Pyramid Pattern.


#Day 1:Number Pyramid in C#.


Source Code :

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

            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=i;j++)
                {
                    Console.Write(j);
                }
                Console.WriteLine();
            }
            Console.Read();
        }
    }
}

OutPut :





No comments:

Post a Comment