Skip to content
Related Articles

Related Articles

Program to Calculate Body Mass Index (BMI)

View Discussion
Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 29 May, 2021

The Body Mass Index (BMI) or Quetelet index is a value derived from the mass (weight) and height of an individual, male or female. The BMI is defined as the body mass divided by the square of the body height and is universally expressed in units of kg/m2, resulting from the mass in kilograms and height in meters. The formula is: 

BMI = (mass or weight)/(height*height)
mass or weight is in Kg,
height is in meters


Input : height(in meter): 1.79832
weight(in Kg): 70
Output : The BMI is 21.64532402096181, so Healthy.
Explanation : 70/(1.79832*1.79832)

Input : height(in meter): 1.58496
weight(in Kg): 85
Output : The BMI is 33.836256857260594 so Suffering from Obesity
Explanation : 70/(1.58496*1.58496)




#Python program to illustrate
# how to calculate BMI
def BMI(height, weight):
    bmi = weight/(height**2)
    return bmi
# Driver code
height = 1.79832
weight = 70
# calling the BMI function
bmi = BMI(height, weight)
print("The BMI is", format(bmi), "so ", end='')
# Conditions to find out BMI category
if (bmi < 18.5):
elif ( bmi >= 18.5 and bmi < 24.9):
elif ( bmi >= 24.9 and bmi < 30):
elif ( bmi >=30):
    print("Suffering from Obesity")


The BMI is 21.64532402096181 so Healthy


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!