fork download
  1. // Jeremy Huang CS1A Chapter 2, Pp. 81, #1
  2.  
  3. /*****************************************************************************
  4.  * COMPUTE SUM
  5.  * ____________________________________________________________________________
  6.  * This program gathers input of two numbers and calculates the sum of those
  7.  * two numbers.
  8.  * ___________________________________________________________________________
  9.  * INPUT
  10.  * num1 : 1st number
  11.  * num2 : 2nd number
  12.  *
  13.  * OUTPUT
  14.  * total : sum of the two numbers
  15.  *
  16.  * **************************************************************************/
  17.  
  18.  
  19. #include <iostream>
  20. using namespace std;
  21.  
  22. int main() {
  23. //Declaring variables
  24. int num1 = 62;
  25. int num2 = 99;
  26.  
  27. //Computing sum
  28. int total = num1 + num2;
  29.  
  30. //Output
  31. cout << "The sum is: " << total << ".";
  32.  
  33. //End program
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5256KB
stdin
Standard input is empty
stdout
The sum is: 161.