fork download
  1. //Castulo Jason Quintero CSC5 Chapter 2, P. 83, #1
  2. //
  3. /**************************************************************
  4.  *
  5.  * COMPUTE SUM OF TWO VARIABLES
  6.  * ____________________________________________________________
  7.  * This program computes the sum of two integers in variable form
  8.  * and store the sum in a variable named total.
  9.  *
  10.  * Computation is based on the formula:
  11.  * total = a + b
  12.  * ____________________________________________________________
  13.  * INPUT
  14.  * a: integer value
  15.  * b: integer value
  16.  *
  17.  * OUTPUT
  18.  * total : Sum of both integers
  19.  *
  20.  **************************************************************/
  21. #include <iostream>
  22. using namespace std;
  23. int main ()
  24. {
  25. int a; //INPUT - integer variable
  26. int b; //INPUT - integer variable
  27. int total; //OUTPUT - Sum of a and b
  28. //
  29. // Initialize Program Variables
  30. a = 62;
  31. b = 99;
  32. //
  33. // Compute Sum
  34. total = a + b;
  35. //
  36. // Output Result
  37. cout << "The sum of the total is " << total << "." << endl;
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
The sum of the total is 161.