Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double calculate_index(double weight, int height)
- {
- double heightInMeters = height / 100;
- double index = weight / (heightInMeters*heightInMeters);
- return index;
- }
- int main()
- {
- double height, weight;
- cin>>height>>weight;
- double index = calculate_index(weight, height);
- if(index < 18.5){
- cout<<"Underweight"<<endl;
- }
- else if(index < 25)
- {
- cout<<"Normal"<<endl;
- }
- else if(index < 30){
- cout<<"Overweight"<<endl;
- }
- else{
- cout<<"Obesity"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement