-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBMI.cpp
More file actions
38 lines (33 loc) · 1.13 KB
/
Copy pathBMI.cpp
File metadata and controls
38 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*1, Make a program that calculates the Body Mass Index (BMI) of a person and determine weather the person is
in normal weight, under weight or over weight. BMI is calculated as (BMI = w/h*h). Make the program to
work for multiple person before terminated.*/
#include<iostream>
using namespace std;
int main(){
float height,weight,BMI;
int choice;
do
{
cout<<"Can you please enter your weight (in Kg): "<<endl;
cin>>weight;
cout<<"Can you please enter your height (in meter): "<<endl;
cin>>height;
BMI=weight/(height*height);
cout<<"BMI= "<<BMI<<endl;
if(BMI<18.5)
{
cout<<"Oh, you are under weight"<<endl;
}else if(BMI<18.5 && BMI<24.9)
{
cout<<"Congra, you have normal weight"<<endl;
}else if (BMI<25 && BMI<29.9)
{cout<<"Oh, you are over weight"<<endl;
}else{
cout<<"Sorry, you are obese"<<endl;
}
cout<<"If you want to continue, please press 1 if not please press 0"<<endl;
cin>>choice;
}
while(choice==1);
cout<<"Great, we did it";
return 0;