Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Blog 

Swap numbers without the third variable using the XOR operator

Language: Layout:
+ ] Show input
Compilation time: 0,14 sec, absolute running time: 0,09 sec, cpu time: 0,09 sec, average memory usage: 13 Mb, average nr of threads: 3, absolute service time: 0,26 sec 
fork mode |  history  | discussion
*** Swap Number Without Third Variable ***
Before Swap
a=7, b=5
Step 1
a=2, b=5
Step 2
a=2, b=7
Step 3
a=5, b=7
After Swap
a=5, b=7

    
                
Advertise here.