C# program to print half Pyramid of Numbers
Program
using System;
namespace PrintHalfPyramidOfNumbers
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Half Pyramid of Numbers");
Console.Write("Enter the number of rows:\t");
int rows = int.Parse(Console.ReadLine());
int i, j;
for (i = 1; i <= rows; ++i)
{
for (j = 1; j <= i; ++j)
{
Console.Write(j + " ");
}
Console.WriteLine();
}
}
}
}
Output
Half Pyramid of Numbers
Enter the number of rows: 6
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6