Answer to Question #124469 in C++ for Noble

Question #124469
Write a program that displays the recommended weight in kilograms, given the user’s age and height in centimeters. The formula for calculating the recommended weight is
Recommended weight = (height – 100 + age %10) *0.90, answer should be in kilograms
1
Expert's answer
2020-06-29T08:14:15-0400
#include <iostream>

using namespace std;

int main()

{

int age;

int height;

cout << "Enter age: \n";

cin >> age;

if (age < 10 || age > 100)

{

cout << "wrong age";

exit(0);

}

cout << "Enter height in centimeters: \n";

cin >> height;

if (height < 100 || height > 255)

{

cout << "wrong height";

exit(0);

}




cout << "Recommended weight is: " << (height - 100 + age % 10) * 0.9 << "kg\n";

}


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