AnkitWebLogic

Input two numbers and swap them

Exercise 12: WAP in Python to input two numbers and swap them. 1

# Input two numbers and swap them | ankitweblogic.com
a=int(input("Input 1st number:"))
b=int(input("Input 2nd number:"))
c=a
a=b
b=c
print("After swapping")
print("A =",a)
print("B =",b)
Input 1st number:10
Input 2nd number:20
After swapping
A = 20
B = 10

Advertisement