Calculate the body mass index. Body mass index compares your weight to your height, and is calculated by dividing your weight in kilograms by your height in meters squared. It gives you an idea of whether you're underweight, a healthy weight, overweight, or obese for your height.
Body Mass Index Categories:
- Underweight = <18.5
- Normal weight = 18.5–24.9
- Overweight = 25–29.9
- Obesity = BMI of 30 or greater
If you are underweight or overweight or obese, determine the ideal weight based on your height and age.
Estimate Ideal body weight in (kg) using Devine formula:
Males: IBW = 50 kg + 2.3 kg for each inch over 5 feet.
Females: IBW = 45.5 kg + 2.3 kg for each inch over 5 feet.
#include <stdio.h>
#include <stdlib.h>
double calculateBMI(double weight, double height);
int main(void)
{
printf("Calculate your BMI\n"); //Calculation of body mass index (BMI)
double w, h, ret;
double BMI = w / (h*h);
ret = calculateBMI(BMI);
printf("Enter your weight in kilograms:\n", w); //Input your weight in kilograms here
scanf("%lf", &w);
printf("Enter your height in metres:\n", h); //Input your height in metres here
scanf("%lf", &h);
printf("Your BMI is %lf\n", ret)
printf("BMI categories:\n");
if (BMI < 18.5)
{
printf("Your BMI is %lf and you are currently underweight.\n");
}
else if (BMI >= 18.5 && BMI <= 24.9)
{
printf("Your BMI is %lf and you are normal weight.\n");
}
else if (BMI >= 25 && BMI <= 29.9);
{
printf("Your BMI is %lf and you are currently overweight.\n");
}
else (BMI >= 30);
{
printf("Your BMI is %lf and you are obese.\n");
}
return 0;
}
double calculateBMI(double weight, double height)
{
double result;
result = weight / (height*height);
return result;
}
Help I still don't know how to do the functions. Please help me.