#K52032. Print Diamond Pattern
Print Diamond Pattern
Print Diamond Pattern
Given an odd integer N (with 1 ≤ N ≤ 15), print a diamond pattern composed of asterisk (*) characters. The diamond has a symmetric structure with the maximum width at the middle line. The number of asterisks in the upper half of the diamond is computed by
\(\text{stars} = 2i + 1\) for row index \(i\) (0-indexed) and for the lower half by
\(\text{stars} = 2(N-i-1) + 1\).
If the input is even, less than 1, or greater than 15, the program should produce no output.
inputFormat
The input consists of a single integer N provided via stdin.
outputFormat
If N is valid (i.e. odd and between 1 and 15 inclusive), output the corresponding diamond pattern to stdout. Each line of the diamond must end with a newline character. If the input is invalid, output nothing.
## sample5
*
</p>