Q. Write a program to swap two numbers using a third variable.


Answer:-


a = int(input('Enter First Number:- '))
b = int(input('Enter Second Number:- '))
c = a, b = b, a
print('New value of Variable a is :- ', a)
print('New value of Variable b is :- ', b)


Output:-

Enter First Number:- 2
Enter Second Number:- 9
New value of Variable a is :-  9
New value of Variable b is :-  2

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post