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