Programming Examples

Python program to input three number and swap 3 numbers


Write a program to input three numbers and swap them as this : 1st number becomes the 2nd number, 2nd number becomes the 3rd number and 3rd number becomes the first number.

Solution

n1=int(input("Enter number 1 : "))
n2=int(input("Enter number 2 : "))
n3=int(input("Enter number 3 : "))
print("Original Number : ",n1,n2,n3)
n1,n2,n3=n2,n3,n1
print("After Swapping : ",n1,n2,n3)
Output

Enter number 1 : 4

Enter number 2 : 5

Enter number 3 : 6

Original Number :  4 5 6

After Swapping :  5 6 4

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad