C# program to print half Pyramid of Stars
Program
using System;
namespace PrintHalfPyramidStar
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Half Pyramid of *");
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("* ");
}
Console.WriteLine();
}
}
}
}
Output
Half Pyramid of *
Enter the number of rows: 4
*
* *
* * *
* * * *