fork download
  1. //Adam Sanchez CIS5 Chapter 2, P.81, #1
  2.  
  3. /**************************************************************************
  4.  * Sum of two numbers
  5.  * ________________________________________________________________________
  6.  * This program calculates the sum of two numbers
  7.  *
  8.  * ________________________________________________________________________
  9.  * INPUT
  10.  * num1: Number 1
  11.  * num2: Number 2
  12.  * OUTPUT
  13.  * Total: Sum of Numbers 1 and 2
  14.  * ________________________________________________________________________
  15.  * ***********************************************************************/
  16.  
  17. #include <iostream>
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22. float num1; //Input - Number 1
  23. float num2; //Input - Number 2
  24. float total; //Output - Sum of number 1 and number 2
  25.  
  26. // Initialize Program Variables
  27. num1 = 62;
  28. num2 = 99;
  29.  
  30. // Compute Total
  31. total = num1 + num2;
  32.  
  33. // Output Results
  34. cout << "The sum of " << num1 << " and " << num2 << " is " << total;
  35. return 0;
  36. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
The sum of 62 and 99 is 161