Created
November 22, 2020 10:30
-
-
Save meidikawardana/ee8d0e206354125b1f0a228926770704 to your computer and use it in GitHub Desktop.
code result from google kotlin codelabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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