fork download
  1. //Xinnuo Wang CS1A chapter 2 , P.81, #1
  2. //
  3. /*******************************************************************************
  4. *
  5. * Sum of Two Numbers
  6. *-------------------------------------------------------------------------------
  7. * This program stores the integers 62 and 99 in variables, and stores the sum of
  8. * these two in a variable named total.
  9. *
  10. * computation is based on the formula:
  11. * total = numb1+ numb2
  12. *-------------------------------------------------------------------------------
  13. * INPUT
  14. * numb1 : stores the first number
  15. * numb2 : stores the second number
  16. * OUTPUT
  17. * total : numb1+ numb2
  18. *
  19. *******************************************************************************/
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main()
  24. {
  25. int numb1 = 62; //INPUT - 62 stores in numb1
  26. int numb2 = 99; //INPUT - 99 stores in numb2
  27. int total = numb1 + numb2; //OUTPUT - sum of two numbers
  28. cout << "The sum of 62 and 99 is : " << total << endl;
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
The sum of 62 and 99 is : 161