Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* swapping of two numbers without used of third variable*/
- #include<stdio.h>
- #include<conio.h>
- int main()
- {
- int no1,no2;//variable declaration
- printf("\nEnter No 1=");
- scanf("%d",&no1);
- printf("\nEnter No 2=");
- scanf("%d",&no2);
- printf("\n Before Swapping value of no1 and no2 is %d and %d",no1,no2);
- no1=no1+no2;
- no2=no1-no2;
- no1=no1-no2;
- printf("\n After Swapping value of no1 and no2 is %d and %d",no1,no2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment