The document provides instructions for printing the upper and lower halves of a diamond pattern separately. It explains that there will be two loops, one for the upper half using (n+1)/2 lines and one for the lower half using n/2 lines. For the upper half, it gives the formulas to calculate the number of spaces and stars for each line based on the current row number. For the lower half, it restarts the row count at 1 and provides different formulas to calculate the number of spaces and stars for each line.
The document provides instructions for printing the upper and lower halves of a diamond pattern separately. It explains that there will be two loops, one for the upper half using (n+1)/2 lines and one for the lower half using n/2 lines. For the upper half, it gives the formulas to calculate the number of spaces and stars for each line based on the current row number. For the lower half, it restarts the row count at 1 and provides different formulas to calculate the number of spaces and stars for each line.
The document provides instructions for printing the upper and lower halves of a diamond pattern separately. It explains that there will be two loops, one for the upper half using (n+1)/2 lines and one for the lower half using n/2 lines. For the upper half, it gives the formulas to calculate the number of spaces and stars for each line based on the current row number. For the lower half, it restarts the row count at 1 and provides different formulas to calculate the number of spaces and stars for each line.
diamond pattern and then the lower half. There will be two loops, one for the upper half i.e. (n+1)/2, and the other for the lower half i.e. for the rest n/2 lines. When currRow=1, For the first-half number of spaces would be (n/2) + 1 - currRow and the number of stars would be (2 * currRow) - 1). For the second half we re-initialize currRow with 1 then, For the second-half number of spaces would be currRow and the number of stars would be 2 * ((n/2) - currRow + 1) - 1 For example, if N=5, then the pattern would look like this,