BMI Calculator

August 30, 2013

A person’s body mass index is a simple calculation based on height and weight that classifies the person as underweight, overweight, or normal. The formulas, for imperial and metric units, are:

BMI (imperial) = weight in pounds / (height in inches)2 * 703

BMI (metric) = weight in kilograms / (height in meters)2

The usual categories are:

BMI <= 18.5: underweight

18.5 < BMI < 25: normal

25 <= BMI < 30: overweight

30 <= BMI < 40: obese

40 <= BMI: morbidly obese

For example, the BMI of a person who is 5′ 4″ and 125 pounds is 21.5 (normal) and the BMI of a person who is 190 centimeters and 95 kilograms is 26.3 (overweight).

Your task is to write a program that calculates the BMI and category given a person’s height and weight. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2