Python Program to Reverse a Number

Python Program to Reverse a Number

How to reverse a number in Python? To reverse a number in Python program here we can use another variable and also modulus operator.


Reverse a Number in Python :



Number = int(input("Please Enter any Number : "))

Reverse = 0
while (Number > 0) :
    Reminder = Number % 10
    Reverse = (Reverse * 10) + Reminder
    Number = Number // 10

print("Reverse of entered number is = %d" %Reverse)
  

Output :