fork download
  1. //Devin Scheu CS1A Chapter 2, P. 81, #1
  2. //
  3. /**************************************************************
  4. *
  5. * CALCULATE SUM OF TWO NUMBERS
  6. * ____________________________________________________________
  7. * This program calculates the sum of two numbers and outputs it.
  8. *
  9. * Computation is based on the formula:
  10. * total = num1 + numb2
  11. * ____________________________________________________________
  12. * INPUT
  13. * num1 : First number to sum (as an integer)
  14. * num2 : Second number to sum (as an integer)
  15. *
  16. * OUTPUT
  17. * total : The sum of num1 and num2
  18. *
  19. **************************************************************/
  20.  
  21. #include <iostream>
  22. #include <iomanip>
  23.  
  24. using namespace std;
  25.  
  26. int main () {
  27.  
  28. //Variable Declarations
  29. int num1; //INPUT - First number to sum (as an integer)
  30. int num2; //INPUT - Second number to sum (as an integer)
  31. int total; //OUTPUT - The sum of num1 and num2
  32.  
  33. //Variable Initialization
  34. num1 = 62;
  35. num2 = 99;
  36.  
  37. //Calculate Sum
  38. total = num1 + num2;
  39.  
  40. //Output Result
  41. cout << "The sum is: " << total << endl;
  42.  
  43. } //end of main()
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
The sum is: 161