Kotlin Code To Create a Pyramid and Pattern. In this program, you will learn to create a pyramid, half pyramid, inverted pyramid, Pascal’s triangle, and Floyd’s triangle sing control statements in Kotlin.
Kotlin Code To Create a Pyramid and Pattern
Source Code
fun main(args: Array<String>) {
val rows = 6
for (i in 1..rows) {
for (j in 1..i) {
print("* ")
}
println()
}
}
Output
Kotlin Code To Create a Pyramid and Pattern