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/ Explanation:

Enter number 1 : 4

Enter number 2 : 5

Enter number 3 : 6

Original Number :  4 5 6

After Swapping :  5 6 4

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad