plz tell me how to do swapping i want to swap the value of b into a and value of a into b without the addition of variable ... plz help me fast i have to run it as soon as possible.
swapper is a variable, so technically your solution does not meet the requirements of the OP.
@OP,
Why the restriction of no added variable?
If you use std::swap, as suggested by others, that function is probably adding a new variable. So, you would probably be implicitly adding a variable even though the code you write does not do so.
Every new programmer learns that swapping the values of 2 variables is done with a 3rd temporary variable:
1 2 3 4 5 6 7
int a = 5;
int b = 7;
int temp;
temp = a;
a = b;
b = temp;
There are a few seemingly clever tricks that exchange the values of two (typically, integer) C-style variables using three reversible binary operations (xor, subtraction/addition, multiplication/division, etc). Whichever way you choose to solve your programming puzzle, make sure to never use that in real code: the proper C++ way, as already mentioned, is to use std::swap, the proper C way is to create a temp variable and use the assignment operator. Use of temp variable is faster, takes up less space, and works for more types and values than those three-step tricks.