Question

write a c++ program where you calculate the BMI using formula weight(kg) / [height(m)]^2 need to...

write a c++ program where you calculate the BMI using formula weight(kg) / [height(m)]^2

need to include arrays

and if statements:

less than 15 very severely under weight

between 15 and 16 severely under weight

between 16 and 18.5 underweight

between 18.5 and 25 healthy

between 25 and 30 overweight

between 30 and 35 obese

display message outside main

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>

using namespace std;

double getBMI(double w, double h){
   return (w/(h*h));
}

int main()
{
   double w,h,bmi;
   
   cout<<"Enter weight: ";
   cin>>w;
   cout<<"Enter height: ";
   cin>>h;
   bmi = getBMI(w,h);
   cout<<"BMI = "<<bmi;
   cout<<endl;
   if(bmi < 15){
       cout<<("very severely under weight");
   } else if(bmi <= 16) {
       cout<<("severely under weight");
   } else if (bmi < 18.5) {
        cout<<("underweight");
    } else if (bmi < 25) {
        cout<<("healthy");
    } else if (bmi < 30) {
        cout<<("overweight");
    } else {
        cout<<("obese");
    }
    cout<<endl;
   return 0;
}

 

Add a comment
Know the answer?
Add Answer to:
write a c++ program where you calculate the BMI using formula weight(kg) / [height(m)]^2 need to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT