For Day 3 of the "101 Days Pyramid Patterns in C# .NET" series, here's a program that prints the following pattern:
#Day 3:Reverse Numerical Triangle
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
Learn how to create dynamic pyramid patterns using C# in our '101 Days Pyramid Patterns in C# .NET' series.
On Day 3, we focus on generating a descending number pattern. This step-by-step tutorial is perfect for beginners looking to enhance their programming skills with practical examples.
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=i;j>=1;j--)
{
Console.Write(j);
}
Console.WriteLine();
}
Console.Read();
}
}
}
No comments:
Post a Comment