Saturday, 26 November 2016

swapping of two numbers


#swapping of two numbers


#taking two numbers from user
a=int(input('enter first number:'))
b=int(input('enter second number:'))

#to display the entered numbers
print("first number:",a)
print('second number:',b)


#to swap the numbers
a,b=b,a

#to display the numbers after swapping
print('after swapping of numbers')
print("first number:",a)
print('second number:',b)


OUTPUT:

No comments:

Post a Comment