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