The Body Mass Index (BMI) is calculated as a person's weight (in kg), divided by the square of the person's height (in meters). If the BMI is between 19 and 25, the person is healthy. If the BMI is below 19, then the person is underweight. If the BMI is above 25, then the person is overweight. Write a program to get a person's weight (in kgs) and height (in cms) and display a message whether the person is healthy, underweight or overweight in python.

BMI = Weight in kg/(Height in m)^2

Code

print("This program will calculate your BMI.")
weight = float(input("Enter your weight in kilograms: "))
height = float(input("Enter your height in meters: "))
bmi = weight / (height ** 2)
if bmi < 19:
print("You are underweight.")
elif bmi > 25:
print("You are overweight.")
else:
print("You are healthy.")

Output