Skip to content

Instantly share code, notes, and snippets.

@Ambratolm
Created June 25, 2017 12:01
Show Gist options
  • Save Ambratolm/a3d5e7c35b4dfcbbda752bcdba0fac07 to your computer and use it in GitHub Desktop.
Save Ambratolm/a3d5e7c35b4dfcbbda752bcdba0fac07 to your computer and use it in GitHub Desktop.
Ecrire un algorithme qui demande l’âge d’un enfant à l’utilisateur. Ensuite, il l’informe de sa catégorie.
#include<stdio.h>
main()
{
printf("--------------------------------\n");
printf("Catégorie d'âge d’un enfant\n");
printf("--------------------------------\n");
float A;
printf("Entrez l'âge de l'enfant: ");
scanf("%f",&A);
//--------------------------------------------------------------
if (A<6 || A>=18)
{
printf("\n");
printf("Veuillez entrer un âge entre 6 et 17 ans ^_^");
printf("\n");
}
//--------------------------------------------------------------
if (A>=6 && A<=7)
{
printf("\n");
printf("L'enfant est un Poussin.");
printf("\n");
}
//--------------------------------------------------------------
if (A>=8 && A<=9)
{
printf("\n");
printf("L'enfant est un Pupille.");
printf("\n");
}
//--------------------------------------------------------------
if (A>=10 && A<=11)
{
printf("\n");
printf("L'enfant est un Minime.");
printf("\n");
}
//--------------------------------------------------------------
if (A>=12 && A<18)
{
printf("\n");
printf("L'enfant est un Cadet.");
printf("\n");
}
//--------------------------------------------------------------
printf("\n");
system("pause");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment