-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex9.cpp
More file actions
36 lines (29 loc) · 856 Bytes
/
ex9.cpp
File metadata and controls
36 lines (29 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// incluindo as bibliotecas necessarias
#include <stdio.h>
#include <stdlib.h>
//metodo inicial pra começar a rodar o codigo
int main()
{
//Declarando variaveis
int idade, faixaA, faixaB, faixaC, faixaD;
for(int i = 1; i <= 15; i++){
printf("Digite a idade da pessoa num %d: ", i);
scanf("%d",&idade);
if(idade < 12){
faixaA++;
}
if(idade >= 12 && idade < 18){
faixaB++;
}
if(idade >= 18 && idade < 30){
faixaC++;
}
if(idade >= 30){
faixaD++;
}
}
printf("Existem %d pessoa(s) menor que 12 anos \n", faixaA);
printf("Existem %d pessoa(s) maior que 12 e menor que 18 anos \n", faixaB);
printf("Existem %d pessoa(s) maior que 18 e menor que 30 anos \n", faixaC);
printf("Existem %d pessoa(s) maior que 30 anos \n", faixaD);
}