Print Right Angle( * ) Star Pattern in Kotlin
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