+ 1

[DUPLICATE] Program to swap two numbers without using a third variable ....kindly help

var

19th Mar 2018, 3:54 AM
AMUKOA A STEPHEN
AMUKOA A STEPHEN - avatar
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
19th Mar 2018, 3:56 AM
Frost
Frost - avatar
+ 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;
19th Mar 2018, 3:57 AM
Naveen Maurya
Naveen Maurya - avatar
+ 1
or you could also use xor. a = a^b; b = a^b; a = a^b;
19th Mar 2018, 7:14 AM
shobhit
shobhit - avatar