Star Triangle Pattern
Star Triangle Pattern
Given an integer N, print a right-angled triangle of asterisks with N rows.
Row 1 has one *, row 2 has two, and so on until row N, which has N of them. There are no spaces before or between the stars.
For N = 3 the output is three lines: , then , then .
This is the standard nested-loop exercise: an outer loop for the rows, an inner loop for the stars in a row.
A single line containing one integer N.
N lines, where line i contains exactly i asterisks.
1 <= N <= 50
3
* ** ***
Row 1 has one star, row 2 has two, row 3 has three.
Submit runs your code against 4 test cases — the 1 shown above plus 3 hidden ones covering the awkward cases. Run sample just tries the first example, which is usually what you want while you are still working it out.