Lesson 10 of 23
Nested Loops: Patterns
10 min 30 XP
The outer loop handles rows and the inner loop prints each row's characters. Campus tests love pyramids and diamonds.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.In a pyramid, row r has (n - r) spaces and (2r - 1) stars. Make the table first, then write the loops.