fork download
  1. //Jacob Silvestre CSC5 Chapter 2, P. 81, #1
  2. //
  3. /*****************************************************************************************
  4.   *
  5.   * SUM OF TWO NUMBERS
  6.   *______________________________________________________________________________________
  7.   * This program stores the integers 62 and 99 in two variables, calculates their sum, and
  8.   * stores it in a variable named total.
  9.   * Computation is based on the formula:
  10.   * total = first + second
  11.   *
  12.   *______________________________________________________________________________________
  13.   * INPUT
  14.   * first: First number
  15.   * second: Second number
  16.   *
  17.   * OUTPUT
  18.   * total : Sum of the two numbers
  19.   *22
  20.   *
  21.   ***************************************************************************************/
  22. #include <iostream>
  23. using namespace std;
  24. int main()
  25. {
  26. int first; //INPUT - First number
  27. int second; //INPUT - Second number
  28. int total; //OUTPUT - Sum of the two numbers
  29.  
  30. //
  31. // Initialize Program Variables
  32. first = 62;
  33. second = 99;
  34. //
  35. // Calculate Sum
  36. total = first + second;
  37. //
  38. // Output Result
  39. cout << "The sum is " << total << endl;
  40. return 0;
  41. }
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
The sum is 161