Advertisement
mominulkarim77

Swap+scanf

Feb 27th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int a, b;
  5.     printf("Enter a integer value of A: ");
  6.     scanf("%d",&a);
  7.     printf("Enter a integer value of B: ");
  8.     scanf("%d",&b);
  9.  
  10.     printf("\nThe values of A and B have been swapped: \n");
  11.  
  12.     a = a + b;
  13.     b = a - b;
  14.     a = a - b;
  15.     printf("\nA = %d\nB = %d\n",a,b);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement