Register now or log in to join your professional community.
let us say the two variables are x & y
x =5
y =7
now we want y =5 and x =7
x = x+y // x =12, y=7
y = x-y // x=12 ,y =5
x = x-y// x =7 and y =5 #
lets say a =10, b =20
a = a ^ b
b = a ^ b
a = a ^ b
a =20, b =10
The other logic is here
x = x*y
y = x/y
x = x/y
Apply the formula for x=5 and y=6
x =5*6 =30
y =30/6 =5
x =30/5 =6
now x=6 & y=5