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