Answer to Question #344544 in C++ for sami

Question #344544

1 Write a program which inputs a person’s height (in centimetres) and weight (in kilograms) and outputs 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
2022-05-24T13:57:43-0400
#include <iostream>

int main()
{
	int weight, height;
	std::cout << "Enter weight: ";
	std::cin >> weight;
	std::cout << "Enter height: ";
	std::cin >> height;

	if (weight < height / 2.5)
	{
		std::cout << "Underweight" << std::endl;
	}
	else if (weight > height / 2.3)
	{
		std::cout << "Overweight" << std::endl;
	}
	else
	{
		std::cout << "Normal" << std::endl;
	}

	return 0;
}

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