0

How to write a reverse number program in python

22nd Nov 2018, 5:37 PM
Saksham Katyal
Saksham Katyal - avatar
2 Answers
+ 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)
22nd Nov 2018, 5:42 PM
inxanedev!
inxanedev! - avatar
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....
28th Nov 2018, 3:23 PM
Eisha Pilkhwal
Eisha Pilkhwal - avatar