fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a, b;
  5.  
  6. printf("Enter two numbers: ");
  7. scanf("%d %d", &a, &b);
  8.  
  9. printf("Before swap: a = %d, b = %d\n", a, b);
  10.  
  11. a = a + b;
  12. b = a - b;
  13. a = a - b;
  14.  
  15. printf("After swap: a = %d, b = %d\n", a, b);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Enter two numbers: Before swap: a = -1082881952, b = 32767
After swap: a = 32767, b = -1082881952