Problems
Given the height π of a triangle, write a program that prints the triangle in the following numeric pattern.
<Conditions>
In the first row, the numbers progress from left to right.
In the next row, the direction reverses, progressing from right to left.
Repeat this alternating pattern for each row, using numbers 1 and 2 up to π.
Input
The triangle height π is given.
π is an odd integer between 1 and 50 inclusive.
Output
Print the triangle with height
If the input value is outside the specified range, output INPUT ERROR!.
Example #1
3
1
3 2
4 5 6
Example #2
5
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
Tag
Source
JUNGOL