fun main() {
   val age = 24
   val layers = 5
   printCakeCandles(age)
   printCakeTop(age)
   printCakeBottom(age, layers)   
}

fun printCakeTop(age: Int) {
    repeat(age+2) {
        print("=")
    }
    println()    
}

fun printCakeCandles(age: Int) {
    print(" ")
    repeat(age) {
        print(",")
    }
    println()
    
    print(" ")
    repeat(age) {
        print("|")
    }
    println()
}

fun printCakeBottom(age: Int, layers: Int) {
  repeat(layers) {
    repeat(age+2) {
      print("@")
    }
    println()
  }
} 
by

Kotlin Online Compiler

Write, Run & Share Kotlin code online using OneCompiler's Kotlin online compiler for free. It's one of the robust, feature-rich online compilers for Kotlin language. Getting started with the OneCompiler's Kotlin editor is easy and fast. The editor shows sample boilerplate code when you choose language as Kotlin and start coding.