Computer Science, asked by ankushkundu78, 7 months ago


5: Write a program in python to swap two numbers using temporary variable​

Answers

Answered by gaganadithyareddy9
3

Answer:

a = 20

b = 30

temp = a

a = b

temp = b

Answered by atrs7391
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