Body Mass Index
We can measure our body fat by using Body Mass Index (BMI) value.
BMI = weight / (height * height)
Weight in kilograms,
height in meter.
Weight = 60 kg
Height = 1.7 m
BMI = 60 / (1.7 * 1.7)
BMI = 20.76
Based on the BMI value, we can categorize people into four following types
Under weight - BMI < 18.5 (less than 18.5)
Normal weight - 18.5 >= BMI <= 25 (greater than or equal to 18.5 and less than or equal to 25)
Over weight - 25 > BMI <= 30 (greater than 25 and less than or equal to 30)
Obese - BMI > 30 (greater than 30)
Let's write a BMI calculator using C
The program will get weight and height from user and tell which type they belong based on the BMI value.