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