Create a number pyramid in C#
August 19, 2022 2022-08-19 20:04Create a number pyramid in C#
public static void NunberPyramid()
{
int numberoflayer = 6, Space, Number;
Console.WriteLine("Print paramid");
for (int i = 1; i <= numberoflayer; i++) // Total number of layer for pramid
{
for (Space = 1; Space <= (numberoflayer - i); Space++) // Loop For Space
Console.Write(" ");
for (Number = 1; Number <= i; Number++) //increase the value
Console.Write(Number);
for (Number = (i - 1); Number >= 1; Number--) //decrease the value
Console.Write(Number);
Console.WriteLine();
}
}

Please comment and share if you like this post and tell us about how we can enhance our posts. Thanks.
Subhajit
This is Subhajit Sinha, with more than 8 years of experience as a full stack developer in renowned Multinational Companies, here in this portal as an online tutor I will guide you personally to level up your programming skills and also will coach you to augment your career and salary as well.
Search
Popular posts
