0
How to write a reverse number program in python
2 Respuestas
+ 2
You can convert the number to a string and then reverse the string, and convert the reversed string back to a number. Like this:
number = 256
strnumber = str(number)
strnumber = strnumber[::-1]
reversednumber = int(strnumber)
print(reversednumber)
0
#program to reverse a number
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 = ", Reverse)
I hope this will help you....