Write a function that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
def intreverse(n):
rev=0
while(n>0):
d=n%10
rev=(rev*10)+d
n=n//10
return rev
def intreverse(n):
rev=0
while(n>0):
d=n%10
rev=(rev*10)+d
n=n//10
return rev
No comments:
Post a Comment