Swap the two Numbers (interchange the value) without using third variable.

5)    Write a program to input two number and Swap the Numbers (interchange the value) without using third variable.


a=int(input("enter the first number : "))
b=int(input("enter the second number : "))
print("before swaping no. :")
print("a= ",a)
print("b= ",b)

a=a+b
b=a-b
a=a-b

print("after swaping no. :")
print("a= ",a)
print("b= ",b)



swap-two-numbers-without-using-third-variable

Comments

Popular posts from this blog