fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double weight, height, bmi;
  6.  
  7. cout << "Enter your weight in kg: ";
  8. cin >> weight;
  9. cout << "Enter your height in meters:";
  10. cin >> height;
  11.  
  12. // CALCULATE bmi
  13. bmi = weight / (height * height);
  14.  
  15. cout << "\n Yout BMI is:" << bmi << "\n";
  16.  
  17. if (bmi < 19) {
  18. cout << "You are UNDERWEIGHT. \n";
  19. }
  20. else if (bmi >= 19 && bmi <= 25) {
  21. cout << "Your weight is NORMAL. \n";
  22. }
  23. else if (bmi > 25 && bmi <= 30) {
  24. cout << "You are OVERWEIGHT.\n";
  25. }
  26. else {
  27. cout << "You have OBESITY. \n";
  28. }
  29.  
  30. cout << "\n=== End of program ===\n";
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
Enter your weight in kg: Enter your height in meters:
 Yout BMI is:inf
You have OBESITY. 

=== End of program ===