Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: if, else-if, else | Structures de Contrôle
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Bases de C#

bookChallenge: if, else-if, else

Tâche

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").

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 14
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: if, else-if, else

Glissez pour afficher le menu

Tâche

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").

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 14
single

single

some-alt