Program to Calculate Body Mass Index (BMI)
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) where, mass or weight is in Kg, height is in meters
Examples:
Input : height(in metre): 1.79832 weight(in Kg): 70 Output : The BMI is 21.64532402096181, so Healthy. Explanation : 70/(1.79832*1.79832) Input : height(in metre): 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.79832weight = 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): print("underweight") elif ( bmi >= 18.5 and bmi < 24.9): print("Healthy") elif ( bmi >= 24.9 and bmi < 30): print("overweight") elif ( bmi >=30): print("Suffering from Obesity") |
chevron_right
filter_none
Output:
The BMI is 21.64532402096181 so Healthy
Recommended Posts:
- Program to calculate value of nCr
- Program to calculate age
- Program to calculate the value of sin(x) and cos(x) using Expansion
- Program to calculate Root Mean Square
- Program to calculate volume of Ellipsoid
- Program to calculate area of a Tetrahedron
- Program to calculate area of Enneagon
- Program to calculate Area Of Octagon
- Program to calculate distance between two points
- Program to calculate Profit Or Loss
- Program to calculate GST from original and net prices
- Python program to calculate age in year
- Program to calculate distance between two points in 3 D
- Program to Calculate the Perimeter of a Decagon
- Program to calculate volume of Octahedron
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



