Write a python program to reverse a number.

 code:-

num=int(input(“Enumter a number”))
rev=0
while num!=0:
rem=num%10 # reminumder
num=num//10 # inumteger divisionum
rev=rev*10+rem
print(rev)

Output:-

Enter a number1234
4321



3 thoughts on “Write a python program to reverse a number.

Leave a Reply

Your email address will not be published.