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