Title: Swapping of two numbers without third
Variable
Program:
a=int(input("Enter a value\n"))
b=int(input("Enter b value\n"))
print("Before Swapping")
print("a=",a)
print("b=",b)
#swapping
a=a*b
b=a//b
a=a//b
print("After Swapping")
print("a=",a)
print("b=",b)
Output:
Enter a value
23
Enter b value
56
Before Swapping
a= 23
b= 56
After Swapping
a= 56
b= 23
Comments
Post a Comment