Are the two inner loops nested inside each other?
No. They are placed sequentially (one after the other) inside the outer loop. The space loop finishes completely before the star loop begins.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Printing a Pyramid Star Pattern (Spaces and Stars)
Because you must print a specific, mathematically decreasing number of invisible space characters before you can print the mathematically increasing stars.
If N is the total height and 'row' is the current row, the formula for leading spaces is N - row.
The stars follow the odd-number sequence, which is mathematically represented as (2 * row) - 1.
Still have questions?
Browse all our FAQs or reach out to our support team
