← Coding round practice

Right-Angled Star Triangle

EasyPatterns

The problem

Print a right-angled triangle of stars with n rows (row i has i stars).

Sample input

5

Sample output

*
**
***
****
*****
Show the solution · 8 languages
fun main() {
    val n = 5
    for (i in 1..n) {
        println("*".repeat(i))
    }
}