+ 3
Write a program to swap two variables without using third variable? (two variables a,b. The value of a should go & b to a)
3 Respuestas
+ 12
a = a + b;
b = a - b;
a = a - b;
In Ruby, you can just do this tho:
a, b = b, a
There is also the bitshift method, waiting for someone to fill in.