fork download
  1. //Jacklyn Isordia CSC5 Chapter 2, P. 81, #01
  2. //
  3. /**************************************************************
  4.  *
  5.  * Computing the sum of two numbers
  6.  * ____________________________________________________________
  7.  * This program computes the sum of two numbers
  8.  *
  9.  * Computation is based on the Formula:
  10.  * Sum of Number 1 and Number 2 = Number 1 + Number 2
  11.  * ____________________________________________________________
  12.  * INPUT
  13.  * num1 : Number 1
  14.  * num2 : Number 2
  15.  *
  16.  * OUTPUT
  17.  * total : Sum of number 1 and number 2
  18.  *
  19.  **************************************************************/
  20. #include <iostream>
  21. using namespace std;
  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 Result
  36. cout << "The sum of " << num1 << " and " << num2 << " is " << total;r
  37. return 0;
  38. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
The sum of 62 and 99 is 161