fork download
  1. //Ivy Whitney CSC5 Chapter 2, P. 81, #1
  2.  
  3. /**************************************************************************
  4. *
  5. *Computing the sum of two numbers
  6. *__________________________________________________________________________
  7. *
  8. *This program computes the sum of two numbers
  9. *
  10. *Computation is in the formula below:
  11. * Sum of Number 1 and Number 2 = Number 1 + Number 2
  12. * _________________________________________________________________________
  13. * INPUT
  14. *
  15. * n1 : Number 1
  16. * n2 : Number 2
  17. *
  18. * OUTPUT
  19. * total : Sum of number 1 and number 2
  20. *
  21. * ************************************************************************/
  22.  
  23. #include <iostream>
  24. using namespace std;
  25. int main ()
  26. {
  27.  
  28. //Inputs
  29.  
  30. float n1;
  31. float n2;
  32. float total;
  33.  
  34. //Input Variables
  35.  
  36. n1 = 9;
  37. n2 = 10;
  38.  
  39.  
  40. //Compute Total
  41.  
  42. total = n1 + n2;
  43.  
  44.  
  45. //Output Results
  46. cout << " The sum of " << n1 << " and " << n2 << " is " << total;
  47. return 0;
  48. }
  49.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
 The sum of 9 and 10 is 19