Skip to main content

C Program to calculate total Body Mass Index BMI with weight and height

Body Mass Index is a simple calculation using a person’s height and weight. To calculate BMI we can use the formula BMI = kg/m2 where kg is a person’s weight in kilograms and m2 is their height in meters squared. Here is a complete C program code to calculate BMI in float value with 2 decimal places.

/* C Program to print BMI based on formula */
#include <stdio.h>
int main()
{
    float wt,ht,bmi;
    printf("\n\t Enter Weight In Kg\t");
    scanf("%f",&wt);
    printf("\n\t Enter height In Meters\t");
    scanf("%f",&ht);
    //Calculate BMI 
    bmi = wt / (ht*ht);
    if (bmi <= 18.5)
    {
        printf ("BMI Report is : %.2f -> Underweight", bmi);
    }else if(bmi <= 24.9)
    {
        printf("BMI Report is :  %.2f -> Normal",bmi);
    }
    else if(bmi >= 25 && bmi <= 29.9)
    {
        printf("BMI Report is : %.2f -> Overweight",bmi);
    }
else
   printf("BMI Report is : %.2f -> Obese",bmi);   
    return 0;
}

Output after after calculating body mass index using c program is below

Enter Weight In Kg	70
Enter height In Meters	2
BMI Report is : 17.50 -> Underweight

2 thoughts to “C Program to calculate total Body Mass Index BMI with weight and height”

Leave a Reply

Your email address will not be published.