Enter the Input row number:7
*
* *
* *
* *
* *
* *
* * * * * * *
*
* *
* *
* *
* *
* *
* * * * * * *
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the input row number");
int n = int.Parse(Console.ReadLine());
for (int row = 1;
row <= n; row++)
{
for (int coll =
1; coll <= row; coll++)
{
if (coll == 1 || row == n || coll == row)
{
Console.Write("*" + " ");
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
Console.ReadLine();
}
}
No comments:
Post a Comment