Header Ads

How to Reverse a Number using Python Program


Example : Code Program


num = int(input("Enter Number:"))

temp = num

rev = 0

while num > 0:

    rem = int(num%10)

    rev = rev * 10 + rem

    num = int(num/10)

print("The reverse is : {}".format(rev))

No comments

Powered by Blogger.