#C3753. Diamond Generator
Diamond Generator
Diamond Generator
Given an integer ( n ), generate a diamond shape pattern using asterisks (*). The diamond has its widest row (the middle row) containing ( 2n - 1 ) asterisks. For each row above the middle, the number of asterisks increases by 2 until the middle is reached, and then it decreases symmetrically. If ( n ) is less than or equal to 0, or if the input does not produce a diamond, output nothing.
For example, when ( n = 3 ), the output should be:
* *** ***** *** *
Note: All formulas are represented in ( \LaTeX ) format.
inputFormat
Input is provided via standard input (stdin) and consists of a single integer ( n ).
outputFormat
Output the diamond pattern corresponding to ( n ) to standard output (stdout). Each line of the diamond should include both leading and trailing spaces so that every line has a width of ( 2n - 1 ). If ( n ) is less than or equal to 0, output nothing.## sample
1
*
</p>