(Body Mass Index)

Design a modular program that calculates and displays a person's body mas index (BMI). The BMI is often used to determine whether a person with a sedentary life style is overweight or underweight for his or her height. A person's BMI is calculated with the following formula: BMI= Weight × 703/Height square. Help Please.......

Respuesta :

Answer:

#include <iostream>

#include <cmath>    // Included for using pow() function.

using namespace std;

int main()

{

   // Variables

   float BMI,

         weight,

         height;

   // Ask user for height & weight

   cout << "Enter weight(in pounds): " << endl;

   cin >> weight;

   cout << "Enter height(in inches, e.g. 5' 9\" = 69): " << endl;

   cin >> height;

   // Calculate & display the person's (BMI)

   BMI = weight * (703 / pow(height, 2));

   // Display BMI

   cout << "BMI = " << BMI << endl;

   // Decision Structure

   if (BMI >= 18.5 && BMI <= 25)

       cout << "Weight optimal." << endl;

   else if (BMI >= 0 && BMI <= 18.5)

       cout << "Weight underweight." << endl;

   else if (BMI >= 25)

       cout << "Weight overweight." << endl;

   // Terminate program

   return 0;

}

Explanation:

ACCESS MORE