Advertisement
ivanwidyan

Program That Reads in Two Numbers and Adds Them Together

Oct 15th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.    
  7.     int firstnum, secondnum, result;
  8.  
  9.     cout << "Please enter your first number: ";
  10.     cin >> firstnum;
  11.     cout << "Please enter your second number: ";
  12.     cin >> secondnum;
  13.     result = firstnum + secondnum;
  14.     cout << firstnum << " + " << secondnum << " = " << result << endl;
  15. }
  16.  
  17. Result:
  18. Please enter your first number: 10
  19. Please enter your second number: 15
  20. 10 + 15 = 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement