Header Ads Widget

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



Post a Comment

3 Comments