Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 61adf5c

Browse files
Add files via upload
1 parent 99786a7 commit 61adf5c

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

‎BMI Calculation in C program.c‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
float w,h;
5+
float bmi;
6+
int ch;
7+
8+
printf("\tBody Mass Index Calculator\n\n");
9+
printf("\t1. BMI in Metric system.\n");
10+
printf("\t2. BMI in American system.\n");
11+
12+
printf("\nEnter any choice : ");
13+
scanf("%d",&ch);
14+
15+
if(ch==1)
16+
{
17+
printf("\nEnter your weight in (kg) : ");
18+
scanf("%f",&w);
19+
20+
printf("\nEnter your height in (meter) : ");
21+
scanf("%f",&h);
22+
23+
bmi=w/(h*h);
24+
printf("\nBMI index value : %f\n",bmi);
25+
26+
if(bmi<=18.5)
27+
{
28+
printf("\nBMI index indicates-'Underweight'.\n");
29+
}
30+
else if(bmi>18.6 && bmi<=24.9)
31+
{
32+
printf("\nBMI index indicates-'Healthy'.\n");
33+
}
34+
else if(bmi>25 && bmi<=29.9)
35+
{
36+
printf("\nBMI index indicates-'Overweight'.\n");
37+
}
38+
else if(bmi>30)
39+
{
40+
printf("\nBMI index indicates-'Obese'.\n");
41+
42+
}
43+
44+
}
45+
46+
else if(ch==2)
47+
{
48+
printf("\nEnter your weight in (lb) : ");
49+
scanf("%f",&w);
50+
51+
printf("\nEnter your height in (inch) : ");
52+
scanf("%f",&h);
53+
54+
bmi=703*(w/(h*h));
55+
printf("\nBMI index value : %f\n",bmi);
56+
57+
if(bmi<=18.5)
58+
{
59+
printf("\nBMI index indicates-'Underweight'.\n");
60+
}
61+
else if(bmi>18.6 && bmi<=24.9)
62+
{
63+
printf("\nBMI index indicates-'Healthy'.\n");
64+
}
65+
else if(bmi>25 && bmi<=29.9)
66+
{
67+
printf("\nBMI index indicates-'Overweight'.\n");
68+
}
69+
else if(bmi>30)
70+
{
71+
printf("\nBMI index indicates-'Obese'.\n");
72+
73+
}
74+
}
75+
else
76+
printf("\nError! Please enter right choice.\n");
77+
78+
return 0;
79+
}
80+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /