5: Write a program in python to swap two numbers using temporary variable
Answers
Answered by
3
Answer:
a = 20
b = 30
temp = a
a = b
temp = b
Answered by
9
a = input('Enter First Value: ')
b = input('Enter Second Value: ')
print("Value of a before swapping: ", a)
print("Value of b before swapping: ", b)
#temporary variable is c here
c = a
a = b
b = c
print("Value of a after swapping: ", a)
print("Value of b after swapping: ", b)
Similar questions