6.WAP to accept any two number and exchange their values.
6.WAP to accept any two numbers and exchange their values.
Code:
a=int(input("Enter the 1 number "))
b=int(input("Enter the 2 number "))
print("Before swapping ")
print("a=",a," b=",b)
c=a
a=b
b=c
print("Before swapping ")
print("a=",a," b=",b)
Output:
Enter the 1 number 5
Enter the 2 number 6
Before swapping
a= 5 b= 6
Before swapping
a= 6 b= 5
Comments
Post a Comment