fork download
  1. // Cenyao Huang. CS1A Homework 5, P. 294, #4
  2.  
  3. /******************************************************************************************************************
  4. * DISPLAY CALORIES BURNED
  5. *
  6. * This program displays the number of calories burned after 10, 15, 20, 25, and 30 minutes
  7. * minutes.
  8. *
  9. * Input
  10. * minutes : the number of minutes on a treadmill
  11. *
  12. * Output
  13. * caloriesBurnt : the number of calories burnt on a treadmill
  14. *
  15. ******************************************************************************************************************/
  16.  
  17. #include <iostream>
  18. using namespace std;
  19.  
  20. int main() {
  21. // Data dictionary
  22. int minutes, caloriesBurnt;
  23.  
  24. // Calculate and display the number of calories burnt
  25. for (minutes = 10; minutes >= 10 && minutes < 30; minutes+=5)
  26. {
  27. caloriesBurnt = minutes * 3.9;
  28. cout << "The number of calories burnt after " << minutes << " minutes is " << caloriesBurnt << endl;
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
The number of calories burnt after 10 minutes is 39
The number of calories burnt after 15 minutes is 58
The number of calories burnt after 20 minutes is 78
The number of calories burnt after 25 minutes is 97