Every pattern is rows of pieces. One loop prints the rows, a nested loop prints the pieces in each row.
1 Outer loop = rows
One pass of the outer loop produces one full line of the pattern.
2 Inner loop = columns
It prints the stars or numbers within the current row, then stops.
3 End each row
One "\n" after the inner loop finishes starts the next line.
4 The pattern trick
Make the inner bound depend on the row: j <= i prints i stars in row i.
5 Spaces count too
Pyramids print leading spaces — another inner loop places them.
Print with a printing press
Outer loop = rows1One pass of the outer loop produces one full line of the pattern. Inner loop = columns2It prints the stars or numbers within the current row, then stops. End each row3One "\n" after the inner loop finishes starts the next line. The pattern trick4Make the inner bound depend on the row: j <= i prints i stars in row i. Spaces count too5Pyramids print leading spaces — another inner loop places them. 5 building blocks make up Print with a printing press
Two loops, two decisions: still rows to print? still columns in this row? Then print, newline, repeat.
process decision input / output start / end Press play — row 1 prints 1 star, row 2 prints 2, row 3 prints 3, because the inner bound is j <= i.
mainThe OS calls main() — execution begins.
Memory
no variables yet — press play
Console
output appears as the program runs…
Click a pattern, then click the loop recipe that prints it.
4 conceptsTap a card to expand ?square 3x3drops into place
?right triangledrops into place
?number pyramiddrops into place
?newline after rowdrops into place
Same triangle shape — but the inner loop prints j, not a star.
Your predicted output — one line per console line
Hint: Row i lets j run from 1 up to i, printing j itself: row 2 prints 1 then 2.
01Every pattern is rows x columns: outer loop for lines, inner loop for the pieces.
02The "\n" after the inner loop is what starts the next row.
03Inner bound j <= i turns a square into a triangle.
04Print j instead of "*" and the triangle becomes a number pyramid.