Title: Swapping of two numbers with 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
c=a
a=b
b=c
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