Print Star ( * ) in Kotlin
Published in
Sep 30, 2019
Print star ( * ) in kotlin.
We are going to print
*****
*****
*****
*****
*****
this pattern .
For this Pattern, we need 2 for loop .
First forloop is for Row.
Second forloop is for Column.
fun squarePatternStar(){
var n = 5
for (i in 0 until n) {
for(j in 0 until n){
print("*")
}
println(" ")
}
}
Above Code Print * as we expected.
fun main(){
squarePatternStar()
}
main function is calling squarePatternStar