Problems
Given the size of a square, write a program that fills the square in a diagonal zigzag pattern as described below.
Conditions
Start filling numbers from the top-left corner.
Continue filling the square in a zigzag pattern along the diagonals, increasing numbers by 1 consecutively.
Input
A single integer π (
Output
Print the square after filling it with numbers in the diagonal zigzag pattern described above.
Separate numbers with a space.
Example #1
3
1 3 4
2 5 8
6 7 9
Example #2
2
1 3
2 4
Tag
Source
JUNGOL