Practice ยท 4 of 5
Star triangle (nested loops)
Implement static void program(int n) that PRINTS a left-aligned triangle of * characters: row 1 has one star, row n has n stars, each row followed by a newline. program(3) prints "*\n**\n***\n".
Difficulty: beginner
Press Submit to check your solution.
Back to lesson: Practice: Practice: Loops