Star Pattern Printer - Problem
Print a right-angled triangle pattern of stars with N rows.
The i-th row should contain exactly i stars, where i ranges from 1 to N.
Each row should be printed on a separate line with no trailing spaces.
Input & Output
Example 1 — Basic Triangle
$
Input:
n = 4
›
Output:
*
**
***
****
💡 Note:
Row 1 has 1 star, row 2 has 2 stars, row 3 has 3 stars, row 4 has 4 stars
Example 2 — Minimum Size
$
Input:
n = 1
›
Output:
*
💡 Note:
Single row with single star
Example 3 — Larger Triangle
$
Input:
n = 5
›
Output:
*
**
***
****
*****
💡 Note:
Five rows with 1, 2, 3, 4, and 5 stars respectively
Constraints
- 1 ≤ n ≤ 1000
Visualization
Tap to expand
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code