Skip to content

Instantly share code, notes, and snippets.

@meidikawardana
Created November 22, 2020 10:30
Show Gist options
  • Save meidikawardana/ee8d0e206354125b1f0a228926770704 to your computer and use it in GitHub Desktop.
Save meidikawardana/ee8d0e206354125b1f0a228926770704 to your computer and use it in GitHub Desktop.
code result from google kotlin codelabs
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(" ") // Print the inset of the candles on the cake
repeat(age) {
print("|")
}
println("")
}
fun printCakeBottom(age : Int, layers: Int){
repeat(layers){
repeat(age + 2) {
print("@")
}
println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment