0
Can someone swap two variables without using a third variable is it possible
only declare two variables and swap their values without using any third or temporary variable.
3 Respostas
+ 3
in python that is :
a,b = b, a
but most likely you are looking for this:
a= a+ b
b = a - b
a = a- b
0
a = 5 , b = 10
a = a + b; // a = 15
b = b - a; // b = 5
a = a - b; // a = 10
like this thank all of you
- 1
Yes, you can do this.
Try to find a way :
It's maths, you'll need to use addition and substraction.
If you want more help ask.