Home Segments Index Top Previous Next

291: Practice

Write a program that displays a message indicating the deviation from the patient's perfect weight, truncated to the nearest integer, of the form The patient is number kilograms overweight or underweight. Your program's input is three numbers: weight in kilograms, height in meters, and a gender code. Be sure that, if the deviation is just 1 kilogram, the word kilogram appears, rather than kilograms.