Write a function that takes a person's age as input and prints 'Minor' if their age is less than 18, 'Adult' if their age is greater than or equal to 18 and less than 65, and 'Senior' if their age is 65 or above.
Declaring functions
Categorizing life stages based on age
Report a typo
Sample Input 1:
17Sample Output 1:
MinorSample Input 2:
35Sample Output 2:
AdultWrite a program in Kotlin
// Declare a function to determine age category based on the given age
fun main() {
// Read the person's age
val age = readLine()!!.toInt()
// Call the function with the age as argument
// Print the result
println()
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.