def myfun(): num = int(input("Please Enter any Number: ")) Reverse = 0 while(num > 0): Reminder = num %10 Reverse = (Reverse *10) + Reminder num = num //10 print("Reverse of entered number is = %d" %Reverse) if __name__=="__main__": myfun()
Please Enter any Number: 1224
Reverse of entered number is = 4221