Here is one other method by which the values can be swaped in all the programing languages:
Quote:
Define 2 variable depending upon the syntax of the language:
a=20
b=30
Now compare both the variable if b>a then
a = b - a ==> 30 - 20 = 10
b = b - a ==> 30 - 10 = 20
a = a + b ==> 10 + 20 = 30
Else vice varsa.
|
This will also do the work.