#K10461. Diamond Pattern Printer
Diamond Pattern Printer
Diamond Pattern Printer
Given an odd positive integer n that is greater than 2, print a diamond pattern composed of '*' characters. The diamond's widest row (its middle) must contain exactly n stars, and each row above and below decreases in star count symmetrically.
If the input value does not satisfy the condition (i.e. it is not an odd positive integer greater than 2), the program should throw an error with the message:
The value of n must be an odd positive integer greater than 2.
For example, if the input is 5
, the output should be:
* *** ***** *** *
inputFormat
The input consists of a single line containing an odd positive integer n (n > 2). This value determines the width of the diamond's middle row.
outputFormat
Output the diamond pattern exactly as described, using '*' characters. Each line must not contain trailing spaces or extra blank lines.
## sample3
*
</p>