The body mas index (BMI) is defined as ratio of the weight of the person (in kelometer) to the square oef height (in meters) . write a program that recieve weight and height calculate the BMI and report the BMI category as per the following table .
BMI category |
BMI |
Starvation |
<15 |
Anorexic |
15.1 to 17.5 |
Under weight |
17.6 to 18.5 |
Ideal |
18.6 to 24.9 |
Over weight |
25 to 25.8 |
Obese |
30 to 30.9 |
Morbidly obese |
>=40 |
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float weight ,height ,BMI;
//Weight should be in kilograms
// /Height should be in meter
printf("Enter the weight of person:");
scanf("%f",&weight);
printf("Enter the height of person:");
scanf("%f",&height);
BMI=weight/pow(height,2);
printf("The BMI of person is :%2f\n",BMI);
if(BMI>0&&BMI<=15)
printf("BMI category is starvation :");
else if(BMI>=15.1&&BMI<=17.5)
printf("BMI category is Anorexic: ");
else if(BMI>17.6&&BMI<=18.5)
printf("BMI category is underweight:");
else if(BMI>18.6&&BMI<=24.9)
printf("BMI category is Ideal:");
else if(BMI>25&&BMI<=25.9)
printf("BMI category is overweight:");
else if(BMI>30&&BMI<=30.9)
printf("BMI category is obese:");
else if (BMI>=40)
printf("BMI category is morbidly obese:");
return 0;
}
output--Enter the weight of person:45
Enter the height of person:1.5
The BMI of person is :20.000
BMI category is Ideal
related program--
Comments
Post a Comment