Q24 The Body Mass Index (BMI) is defined as ratio of the weight of a person (in kilograms) to the square of the height (in meters). Write a program that receives weight and height, calculates the BMI, and reports the BMI category as per the following table:

The Body Mass Index (BMI) is defined as ratio of the weight of a person (in kilograms) to the square of the height (in meters). Write a program that receives weight and height, calculates the BMI, and reports the BMI category as per the following table:

Program: 92

The Body Mass Index (BMI) is defined as ratio of the weight of a person (in kilograms) to the square of the height (in meters). Write a c program that receives weight and height, calculates the BMI, and reports the BMI category as per the following table:

Body Mass Index Table

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    float weight, height, BMI;
    //Weight should be in Kilograms
    //Height should be in Meters

    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");

}

Output:

 Enter the weight of person: 45
 Enter the height of person: 1.5
 The BMI of person is: 20.00
 BMI Category is Ideal

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.