Kotlin question from a tutorial | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Kotlin question from a tutorial

Hello to everyone reading, can you please explain the answer to this question? How would you modify this main() function so that it prints a 6-layer cake for someone's 4th birthday? fun main() { val age = 24 val layers = 5 printCakeCandles(age) printCakeTop(age) printCakeBottom(age, layers) } Answer Options : 1. Set val age to 6, set val layers to 4 2. Set val age to "4", set val layers to "6" 3. Set val age to 4, set val layers to 6 4. Leave the code as-is

15th Sep 2020, 5:14 PM
Parvesh Khatri
Parvesh Khatri - avatar
1 Answer
+ 4
The answer is 3. To be a 4th birthday, age must be 4. To have a 6-layer cake, layers must be 6.
17th Sep 2020, 2:29 AM
John Wells
John Wells - avatar