I wnt one help....swapping two numbers without using third variable for jsp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I wnt one help....swapping two numbers without using third variable for jsp

please help me...

17th Sep 2017, 8:55 AM
karthiga
3 Answers
+ 15
I would not use it as it is not readable, but still it should work: x = x ^ y ^ (y = x);
17th Sep 2017, 9:46 AM
Nikolay Nachev
Nikolay Nachev - avatar
+ 6
a = a + b b = a - b a = a - b do tgat make sense? let me check. a = 5 and b=6 a = 11 b = 5 a = 6
17th Sep 2017, 9:15 AM
Paul
+ 1
thanku fr all...nikolay sir thanku. x = x ^ y ^ (y = x); its new type of swapping...its wrk it...
17th Sep 2017, 10:02 AM
karthiga