fork download
  1. //Cenyao Huang CS1A Homework 2, P. 81, #1
  2.  
  3. /************************************************************************************************
  4. * COMPUTE THE VALUE OF INTEGERS
  5. * This program computes the value of two integers by adding them together.
  6. *
  7. * This computation uses the formula:
  8. * total = x + y
  9. *
  10. * Input
  11. * x : the value of x
  12. * y : the value of y
  13. *
  14. * Output
  15. * total : the value of x and y added together
  16. *
  17. **********************************************************************************************/
  18.  
  19. #include <iostream>
  20. using namespace std;
  21.  
  22. int main() {
  23. int total; // Define variables
  24. int x = 62, y = 99;
  25.  
  26. total = x + y; // computation using formula
  27. cout << total << endl;
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
161