← Back to Loops
Question 204
Right Triangle of Stars (Practice)
Right Triangle of Stars (Practice)
Write a program that prints a right triangle made of asterisks with 5 rows. The first row has one star, the second has two, and so on down to five stars in the last row. Use an outer loop for the rows and an inner loop that prints the correct number of stars for the current row, then moves to a new line. There is no input.
Expected Output:
* ** *** **** *****
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Loops
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.