fork download
  1. //Matthew Santos CS1A Ch. 3, Pg. 144, #7
  2. /***********************************************
  3.  *
  4.  * CACLULATE CALORIES EATEN
  5.  * _____________________________________________
  6.  * Calculates the amount of calories consumed
  7.  * based off the amount of cookies eaten.
  8.  * _____________________________________________
  9.  * INPUT
  10.  * cookies : amount of cookies eaten
  11.  *
  12.  * OUTPUT
  13.  * calories : total amount of calories
  14.  * consumed
  15.  ***********************************************/
  16. #include <iostream>
  17. #include <iomanip>
  18. using namespace std;
  19.  
  20. int main() {
  21.  
  22. int cookies;
  23. int calories;
  24. int calpercookie;
  25.  
  26. cin >> cookies;
  27.  
  28. calpercookie = 300 / 4;
  29. calories = calpercookie * cookies;
  30.  
  31. cout << "Calories conusmed: " << calories;
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5284KB
stdin
29
stdout
Calories conusmed: 2175