+ 1

[DUPLICATE] Ouestion

how to swap two numbers without using a third variable.

5th Mar 2018, 5:41 PM
Rishabh
11 Answers
+ 19
//duplicate : make use of search bar , many similiar questions already exists https://www.sololearn.com/Discuss/575040/?ref=app
5th Mar 2018, 6:08 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
int a; int b; a=a+b; b=a-b; a=a-b;
5th Mar 2018, 5:59 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 10
@Ace... now you're just being hurtful and hitting below the belt. Let's try to remain civil here. đŸ˜ đŸ˜ĄđŸ€ŹđŸ€Ż đŸ€ŁI'm sure there is something you are thinking about and I am missing. But, logical operators also exist in Javascript: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_logical_operators Oh... and as another person who is well acquainted with PHP, feel free to hate on that as much as you'd like. The enemy of my enemy is my friend. đŸ€—
5th Mar 2018, 9:18 PM
David Carroll
David Carroll - avatar
+ 9
@Ace... Did you go and pull bitwise operators out of Javascript again? Eh hem... give back and stop picking on the little web languages. 😂 Seriously though, Javascript supports XOR. IIRC It's been around since ECMA 1.0. I'd need to verify though.
5th Mar 2018, 6:55 PM
David Carroll
David Carroll - avatar
5th Mar 2018, 7:05 PM
Tanay
Tanay - avatar
+ 5
ace what languages is the xor applicable?
5th Mar 2018, 6:19 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 4
I don't know,@ace seems to have something against web,verified it exists in php,i really really doubt JavaScript
5th Mar 2018, 6:59 PM
᠌᠌Code X
᠌᠌Code X - avatar
5th Mar 2018, 6:58 PM
Michael Simnitt
Michael Simnitt - avatar