#K88457. Spiral Matrix Generation
Spiral Matrix Generation
Spiral Matrix Generation
Given an integer \( n \), generate an \( n \times n \) matrix filled with consecutive integers from \(1\) to \(n^2\) arranged in a spiral order (clockwise starting from the top-left corner). If \( n \) is non-positive, output nothing.
Each row of the matrix should be displayed on a separate line with the numbers separated by a single space.
inputFormat
The input consists of a single integer \( n \) provided via standard input.
outputFormat
Output the spiral matrix with each row on a new line and numbers separated by a space. If \( n \) is non-positive, do not output anything.
## sample3
1 2 3
8 9 4
7 6 5
</p>