0
Help me
fun main(args: Array<String>) { var age = readLine()!!.toInt() //var Child=0-11 //var Teen=12-17 //var Adult=18-64 //var Senior= 65 var age=42 if(Child<=age && Teen<=age) print("Invalid age"){ if(Adult==age && Senior>=age) print("Adult") } }
2 odpowiedzi
0
As the input data is age, you need to output the age group according to the following category: Child: 0-11 Teens: 12 - 17 years old Adult: 18–64 Senior: 65+ If the age is negative, you need to output "Invalid Age". Example Input Data: 42 Sample Output Data: Adult

0
// assuming Kotlin as target language:
var age = readLine()!!.toInt()
if (age < 0) { print("Invalid Age") }
else if (age < 12) { print("Child") }
else if (age < 18) { print("Teen") }
else if (age < 75) { print("Adult") }
else { print("Senior") }