In this Python program, we will learn how to reverse a number. In this program using a
Here is the source code of the program to reverse a number.
# Python Program to Reverse a Number # Take the Input from the User Number = int(input("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)
Enter any Number: 5112
Reverse of entered number is = 2115
Enter any Number: 523654
Reverse of entered number is = 456325