Answers for "kotlin program to print full pyramid"

0

kotlin program to print full pyramid

fun main(args: Array<String>) {
    val rows = 5
    var k = 0

    for (i in 1..rows) {
        for (space in 1..rows - i) {
            print("  ")
        }

        while (k != 2 * i - 1) {
            print("* ")
            ++k
        }

        println()
        k = 0
    }
}
Posted by: Guest on May-30-2021

Code answers related to "kotlin program to print full pyramid"

Browse Popular Code Answers by Language