Diebold Nixdorf interview question

Swap two integers, say a =4 and b=6, without using a third variable.

Interview Answers

Anonymous

15 May 2018

a=a+b b=a-b a=a-b

1

Anonymous

13 Jul 2015

#include int main() { int x = 4, y = 6; x = x ^ y; y = x ^ y; x = x ^ y; printf("After Swapping: x = %d, y = %d", x, y); return 0; }

Anonymous

11 Aug 2013

I couldn't answer it. The answer is: a=a*10+b b=a/10 a=a%10

1