Challenge: if, else-if, else
Taak
Swipe to start coding
Write a program that reads an integer age from the user and prints the user's category based on the following rules:
- If the age is less than 18, print "child";
- If the age is 18 or older but less than 65, print "adult";
- If the age is 65 or older, print "senior".
Use if, else if, and else statements to implement this logic. Only print the category name ("child", "adult", or "senior").
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 14
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 1.25
Challenge: if, else-if, else
Veeg om het menu te tonen
Taak
Swipe to start coding
Write a program that reads an integer age from the user and prints the user's category based on the following rules:
- If the age is less than 18, print "child";
- If the age is 18 or older but less than 65, print "adult";
- If the age is 65 or older, print "senior".
Use if, else if, and else statements to implement this logic. Only print the category name ("child", "adult", or "senior").
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 14
single