-
Notifications
You must be signed in to change notification settings - Fork 0
/
bodyMassIndex.c
43 lines (31 loc) · 1.33 KB
/
bodyMassIndex.c
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
37
38
39
40
41
42
43
#include <stdio.h>
#define UNDER_WEIGHT 18.5
#define NORMAL_WEIGHT 25.0
#define PRE_OBESITY 30.0
#define GRADE_1_OBESITY 35.0
#define GRADE_2_OBESITY 40.0
int main(void){
float height, heightSquared, weight, bodyMassIndex, minimumWeight, maximumWeight;
printf("Digite a sua altura:");
scanf("%f", &height);
printf("Digite o seu peso:");
scanf("%f", &weight);
heightSquared = ( height * height );
bodyMassIndex = ( weight ) / heightSquared;
minimumWeight = ( NORMAL_WEIGHT ) * heightSquared;
maximumWeight = ( PRE_OBESITY ) * heightSquared;
printf("Sua classificaçăo pela OMS:");
if (bodyMassIndex < UNDER_WEIGHT) printf("Abaixo do peso.");
else if (bodyMassIndex < NORMAL_WEIGHT) printf("Peso normal.");
else if (bodyMassIndex < PRE_OBESITY) printf("Pre obesidade.");
else if (bodyMassIndex < GRADE_1_OBESITY) printf("Obesidade grau 1.");
else if (bodyMassIndex < GRADE_2_OBESITY) printf("Obesidade grau 2.");
else printf("Obesidade grau 3.");
printf("\n\n");
printf("A sua faixa de peso recomendada pela OMS:");
printf("%5.1f", minimumWeight);
printf(" ate ");
printf("%5.1f", maximumWeight);
printf("\n\n");
return 0;
}