Search code examples
programming-languages

Swapping using two variables not three?


Possible Duplicate:
Swapping two variable value without using 3rd variable

we have

int a=4;
int b=7;

can i swap these no.s without using third variable?


Solution

  • a=a+b;
    b=a-b;
    a=a-b;