-
Notifications
You must be signed in to change notification settings - Fork 93
/
BMI Calculator
50 lines (44 loc) · 1.03 KB
/
BMI Calculator
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
44
45
46
47
48
49
50
#include < stdio.h >
int main()
{
float height, weight, bmi;
printf("Enter height in meter\n");
scanf("%f", &height);
printf("Enter weight in kg\n");
scanf("%f", &weight);
bmi = weight / (height * height);
printf("Your Body Mass Index(BMI) is %f\n", bmi);
if(bmi < 15)
{
printf("Your BMI category is: Starvation\n");
}
else if(bmi >= 15.1 && bmi <= 17.5)
{
printf("Your BMI category is: Anorexic\n");
}
else if(bmi >= 17.6 && bmi <= 18.5)
{
printf("Your BMI category is: Underweight\n");
}
else if(bmi >= 18.6 && bmi <= 24.9)
{
printf("Your BMI category is: Ideal\n");
}
else if(bmi >= 25 && bmi <= 25.9)
{
printf("Your BMI category is: Overweight\n");
}
else if(bmi >= 30 && bmi <= 30.9)
{
printf("Your BMI category is: Obese\n");
}
else if(bmi >= 40)
{
printf("Your BMI category is: Morbidly Obese\n");
}
else
{
printf("Wrong entry\n");
}
return 0;
}