Created
May 11, 2018 16:56
-
-
Save edenizk/741a58cced03bf08568b24dd85e6724f to your computer and use it in GitHub Desktop.
BMI calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| /* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
| int main(int argc, char** argv) { | |
| double bmi,w,h; | |
| cout<<"Welcome to BMI(body mass index) calculator\n for start please write your weight[kilogram]:"; | |
| cin>>w; | |
| cout<<"write your height[meter]:"; | |
| cin>>h; | |
| if (h>100){ | |
| h=h/100; | |
| } | |
| bmi=w/(h*h); | |
| if(bmi<=18.5){ | |
| cout<<"your BMI is: "<<bmi<<"\n you are underweight"; | |
| } | |
| else if(bmi>18.5&&bmi<=25){ | |
| cout<<"your BMI is: "<<bmi<<"\n you are healthy :)"; | |
| } | |
| else if(bmi>25&&30>=bmi){ | |
| cout<<"your BMI is: "<<bmi<<"\n you are overweight"; | |
| } | |
| else if(bmi<=40&&bmi>30){ | |
| cout<<"your BMI is: "<<bmi<<"\n you are obese"; | |
| } | |
| else if(bmi>40){ | |
| cout<<"your BMI is: "<<bmi<<"\n you are extremely obese you need to do something!!"; | |
| } | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment