+ 1
[DUPLICATE] Program to swap two numbers without using a third variable ....kindly help
var
3 Answers
+ 16
Please use the search bar , as the question you have may be already asked in the Q&A before
https://www.sololearn.com/discuss/772447/?ref=app
+ 3
By this very simple algorithm:
a = a + b;
b = a - b;
a = a - b;
//Or
a = a ^ b;
b = a ^ b;
a = a ^ b;
+ 1
or you could also use xor.
a = a^b;
b = a^b;
a = a^b;