Write a program which inputs a persons height (in centimeters)and weight (in kilograms)and output one of the messages:underweight, normal, or overweight, using the criteria:
Underweight: weight<height/2.5
Normal: height/2.5<=weight<=height/2.3
overweight: height/2.3<weight
#include <iostream>
using namespace std;
int main()
{
int height, weight;
cout << "Enter height in centimeters: ";
cin >> height;
cout << "Enter weight in kilograms: ";
cin >> weight;
cout << endl;
if (weight < height / 2.5)
cout << "UNDERWEIGHT";
else if (height / 2.3 < weight)
cout << "OVERWEIGHT";
else
cout << "NORMAL";
cout << endl;
}
Comments
Leave a comment