netx_iit

swapping of two value

Jul 23rd, 2020 (edited)
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. //w.a.p. which swap two value give by user.
  2. /*
  3. After swapping(original value)
  4. a=10
  5. b=20
  6.  
  7. before swapping
  8. a=20
  9. b=10
  10. */
  11.  
  12. #include<stdio.h>
  13. #include<conio.h>
  14. int main()
  15. {
  16.     int no1,no2,temp;//variable declaration
  17.     printf("\nEnter No 1=");
  18.     scanf("%d",&no1);
  19.     printf("\nEnter No 2=");
  20.     scanf("%d",&no2);
  21.     printf("\n Before Swapping value of no1 and no2 is %d and %d",no1,no2);
  22.     temp=no2;
  23.     no2=no1;
  24.     no1=temp;
  25.     printf("\n After Swapping value of no1 and no2 is %d and %d",no1,no2);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment