Answer to Question #225875 in C++ for Ulando

Question #225875

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



1
Expert's answer
2021-08-15T01:16:17-0400
#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;


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS