Single File Programming Question
Problem Statement
Alex wants to generate a number pattern based on a specified number of rows. Write a program that reads the number of rows and prints a pyramid-like pattern where each row contains consecutive numbers increasing to a peak and then decreasing back down. The pyramid should be centered with appropriate spacing.
Input
5 // number of rowsOutput
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5Input format
The input consists of an integer n, representing the number of rows.
Output format
The output prints the required pattern.
Refer to the sample output for the formatting specifications.
Code constraints
1 ≤ n ≤ 12Sample test cases
Input 1
5Output 1
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5Input 2
4Output 2
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4