fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a, b, temp;
  7.  
  8. cout << "Enter two numbers: ";
  9. cin >> a >> b;
  10.  
  11. temp = a;
  12. a = b;
  13. b = temp;
  14.  
  15. cout << "After swapping:" << endl;
  16. cout << "a = " << a << endl;
  17. cout << "b = " << b << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5308KB
stdin
20
25
stdout
Enter two numbers: After swapping:
a = 25
b = 20