#K94587. Diamond Pattern
Diamond Pattern
Diamond Pattern
Given an integer n
, print a diamond pattern composed of numbers. The diamond has an upper half (including the middle line) and a lower half. On the i-th line (1-indexed) of the upper half, print n-i
spaces followed by the concatenation of numbers from 1 to 2*i-1
. The lower half is the mirror image of the upper half (excluding the middle line).
Constraints: \(1 \leq n \leq 50\).
If n
is not within the allowed range, the program should produce an error.
inputFormat
The input is provided via stdin and consists of a single integer n
.
outputFormat
The output is printed to stdout and displays the diamond pattern corresponding to the given integer n
.
1
1
</p>