Swapping two numbers by 4 different methods using c

Swapping two numbers by 4 different methods using c

Any queries in above problem comment below and any problem to be coded let me know... //swap using three variables #include"stdio.h" #include"conio.h" void main() { int a,b,c; clrscr(); scanf("%d%d",&a,&b); printf("\nBefore swapping:"); printf("\na=%d\nb=%d",a,b); c=a; a=b; b=c; printf("\nAfter swapping:"); printf("\na=%d\nb=%d",a,b); getch(); } //swap without using third variable #include"stdio.h" #include"conio.h" void main() { int a,b; clrscr(); scanf("%d%d",&a,&b); printf("\nBefore swapping:"); printf("\na=%d\nb=%d",a,b); a=a*b; b=a/b; a=a/b; printf("\nAfter swapping:"); printf("\na=%d\nb=%d",a,b); getch(); } //swap two numbers within single line #include"stdio.h" #include"conio.h" void main() { int a,b,c; clrscr(); scanf("%d%d",&a,&b); printf("\nBefore swapping:"); printf("\na=%d\nb=%d",a,b); a=(a+b)-(b=a); printf("\nAfter swapping:"); printf("\na=%d\nb=%d",a,b); getch(); } //swapping two numbers using bitwise operators #include"stdio.h" #include"conio.h" void main() { int a,b,c; clrscr(); scanf("%d%d",&a,&b); printf("\nBefore swapping:"); printf("\na=%d\nb=%d",a,b); a=a^b; b=a^b; a=a^b; printf("\nAfter swapping:"); printf("\na=%d\nb=%d",a,b); getch(); }