CJCoding With Joseph
15free / daySign inCreate account

Star Triangle

Print a left-aligned triangle made of asterisks: 1 star on the first row, 2 on the second, and so on up to 5 stars on the fifth row. This needs a loop inside a loop. The outer loop handles each row number, and the inner loop prints the correct number of stars for that row using Console.Write (which does not add a line break). After the inner loop, call Console.WriteLine() with no text to move to the next row.

Expected Output:

*
**
***
****
*****

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
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 (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.