index | submit | rank | book

bmi – Body Mass Index

The Body Mass Index (BMI) can be used to classify weight in adults. The BMI of a person is given by the weight in kilogrammes divided by the square of the height in metres [WHO, CDC, NHS]. Based on the BMI, a person can be classified in one of four statistical categories: underweight, normal weight, overweight or obese. See the following table:

BMI = w/h² (kg/m²)

       BMI < 18.5  underweight
18.5 ≤ BMI < 25    normal weight
25   ≤ BMI < 30    overweight
30   ≤ BMI         obese

The above are statistical categories. To evaluate an individual’s health, one should consult with a trained healthcare provider.

BMI Graph: weight x height

Write a program that given the weight and height of a person prints the corresponding BMI classification.

Input and Output

The input consists of several lines, each containing two numbers h and w with up to two decimal points where

0.10 ≤ h < 3.00

1.0 ≤ w ≤ 999.9

For each line of input, the output should contain a single line with the corresponding BMI classification in lowercase letters: underweight, normal weight, overweight or obese.

Example input

1.75 69.9
1.60 65
1.91 111.1

Example output

normal weight
overweight
obese

Scoring

try first: oddeven

try next: triangle

index | submit | rank | book

Copyright © 2020-2023 Rudy Matela
All rights reserved