fork download
  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::cin;
  5. using std::endl
  6.  
  7. ;int main()
  8. {
  9. //variable declarations
  10. int height;
  11. int weight;
  12. int BMI;
  13.  
  14. cout << "Enter your height (cm) and weight (kg):\n ";
  15. cin >> height >> weight;
  16.  
  17. BMI = weight / ((height/100)^2);
  18.  
  19. cout << "Your BMI is " << BMI << endl;
  20. }
Success #stdin #stdout 0s 3472KB
stdin
175 68
stdout
Enter your height (cm) and weight (kg):
 Your BMI is 22