+ 2
Swap two number without using third variable
Swap two number without using third variable. Input: a=5 b=10 Output: a=10 b=5 https://code.sololearn.com/cx2gjn0UEA46/?ref=app
1 Resposta
+ 5
You can also do it using tuple and believe me it's the easiest way to swap, though it just for python
a = int(input("Enter first number:- "))
b = int(input("Enter second number:- "))
print(" Before:- ", (a, b))
a, b = b, a
print(" After:- ", (a, b))