This equation swaps two numbers without a temporary variable, but uses arithmetic operations:
a = (a+b) - (b=a);
How can I do it without ar
Multiplication and division can also be used.
int x = 10, y = 5; // Code to swap 'x' and 'y' x = x * y; // x now becomes 50 y = x / y; // y becomes 10 x = x / y; // x becomes 5