Reverse number Program in Python


Prev Tutorial Next Tutorial

Reverse number Program in Python

Using modulus operator and if statement you can write this code. And remaining concept are apply same like C programming only change syntax.

Reverse number Program in Python

num = int(input("Enter any Number: "))
Reverse = 0
while(num > 0):
    Reminder = num %10
    Reverse = (Reverse *10) + Reminder
    num = num //10
 
print("\n Reverse of entered number is: %d" %Reverse)

Output

	
Enter any number: 231
Reverse of entered number is: 132

Prev Tutorial Next Tutorial

Advertisements
Download Projects