fork download
  1. //Taylor Johnson CS1A Chapter 2, P. 81, #1
  2. //
  3. /*******************************************************************************
  4.  *
  5.  * CALCULATE THE SUM OF TWO INTEGERS
  6.  *______________________________________________________________________________
  7.  * This program calculates the sum of two integers and stores the value in
  8.  * a variable labeled "total"
  9.  *
  10.  * Program is centered on the formula:
  11.  * total = int1 + int2
  12.  * _____________________________________________________________________________
  13.  * INPUT
  14.  * int1 : integer value
  15.  * int2 : separate integer value
  16.  *
  17.  * Output
  18.  * total : the sum of the two integers added together
  19.  *
  20.  *****************************************************************************/
  21.  
  22.  
  23. #include <iostream>
  24. using namespace std;
  25.  
  26. int main()
  27. {
  28. //assign integer variables a value
  29. int total, numA = 62, numB = 99;
  30. //
  31. // add the two integers and store in total
  32. total = numA + numB;
  33. cout << total <<endl;
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
161