Print Right Angle( * ) Star Pattern in Kotlin

Jaspreet Singh
McAppMedia
Published in
Oct 1, 2019

Today we are going to print Right Angle Star Pattern in Kotlin.

Expected OutPut :

*
**
***
****

Below is the Program in Kotlin to print Star (*) right angle

fun main(){

rightTrianglePattern()
}

fun rightTrianglePattern(){

var n=5

for (i in 0 until n){

for(j in 0 until i){
print("*")
}
println(" ")
}
}

In above program we are getting 2 loops , Outer loop is for row, that how many much rows we need, and inner loop is for column, that is much star we have to print.

In the last line we have written println(“ “), that is empty space and enter for newLine, so next line will be print.

You can read Pyramid Triangle 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.