0

How to switch two int with out third int

a=20 b=30 run a=30 b=20

17th Feb 2017, 7:45 AM
Ali Zeawo
Ali Zeawo - avatar
5 Answers
+ 8
a = a + b; b = a - b; a = a - b;
17th Feb 2017, 7:48 AM
Kawaii
Kawaii - avatar
+ 4
a = (b = b ^ (a = a ^ b)) ^ a;
17th Feb 2017, 5:17 PM
TamĂĄs Barta
TamĂĄs Barta - avatar
+ 2
Sorry, I fixed that. Here is a simpler version: a = a ^ b; b = a ^ b; a = a ^ b;
18th Feb 2017, 7:42 PM
TamĂĄs Barta
TamĂĄs Barta - avatar
0
thanks so much 😍😍😍😍
17th Feb 2017, 7:52 AM
Ali Zeawo
Ali Zeawo - avatar
0
sorry Tamas barta your program is wrong đŸ˜¶đŸ˜¶đŸ˜¶
18th Feb 2017, 6:23 PM
Ali Zeawo
Ali Zeawo - avatar