diogoAlves

IFF/Introdução à Programação/Slide/Pag 24/Ex 2

Feb 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 24 - Exercício 2
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     setlocale(LC_ALL,"Portuguese");
  8.     int idade;
  9.     printf("Entre com a idade: ");
  10.     scanf("%d",&idade);
  11.     if (idade>=0){
  12.         switch (idade){
  13.             case 0 ... 3:
  14.                 printf("Bebê.");
  15.             break;
  16.             case 4 ... 10:
  17.                 printf("Criança.");
  18.             break;
  19.             case 11 ... 18:
  20.                 printf("Adolescente.");
  21.             break;
  22.             default:
  23.                 printf("Adulto.");
  24.             break;
  25.         }
  26.     }else{
  27.         printf("Idade inválida.");
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment