Patterns
Read · 1 of 3
Let the row decide
For a triangle, row i has i stars, so the inner loop goes up to i instead of a fixed number.
For shapes with leading spaces, print the spaces first (another inner loop), then the stars.
1*2**3***
Read · 1 of 3
For a triangle, row i has i stars, so the inner loop goes up to i instead of a fixed number.
For shapes with leading spaces, print the spaces first (another inner loop), then the stars.
1*2**3***