fork download
  1. //Zachary Abdollahi CS1A Chapter 2, P. 81, #1
  2. //
  3. /*****************************************************************************
  4.  * SUM OF TWO NUMBERS
  5.  * ___________________________________________________________________________
  6.  * This program stores two specific integers (62 and 99) in variables,
  7.  * calculates their sum, and stores the result in a variable named 'total'.
  8.  * Finally, it displays the calculated total to the console.
  9.  *
  10.  * Computation is based on the formula:
  11.  * Total = num1 + num2
  12.  * ___________________________________________________________________________
  13.  * INPUT
  14.  * num1 : First integer value (62)
  15.  * num2 : Second integer value (99)
  16.  *
  17.  * OUTPUT
  18.  * total = : Sum of num1 and num2
  19.  ****************************************************************************/
  20.  
  21. #include <iostream>
  22.  
  23. int main() {
  24. // Store the given integers in variables
  25. int num1 = 62;
  26. int num2 = 99;
  27.  
  28. // Calculate the sum and store it in a variable named 'total'
  29. int total = num1 + num2;
  30.  
  31. // Output the result
  32. std::cout << "The sum of " << num1 << " and " << num2 << " is: " << total << std::endl;
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
The sum of 62 and 99 is: 161