Print Left Traingle Star (*) in Kotlin

Jaspreet Singh
McAppMedia
Published in
Oct 1, 2019

Today we are going to print left traingle star in kotlin.

Expected Output

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

Below is the Program.
fun main(){
leftTriangle()
}

fun leftTriangle(){

var n=4

for (i in 0 .. n){
for (j in 0.. n-i){
print(" ")
}

for (k in 0.. i){
print("*")
}
println(" ")
}
}

You can read Pyramid Traingle here

--

--

Jaspreet Singh
McAppMedia

Working in Android Developemen and Tech Mentor .My Github profile is: https://github.com/jaspreet1990 , Contact me at preetjaspreet90@gmail.com for more info.