Nokia interview question

You have x and y variables. Swap the values without using a 3rd variable.

Interview Answers

Anonymous

20 Mar 2017

xor

2

Anonymous

15 Jun 2017

x=5; y=2; x=x+y; //x=5+2=7 x=7 y=x-y; //y=7-2=5 y=5 x=x-y;//x=7-5=2 x=2

2

Anonymous

13 Sept 2016

Algebra