Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n in python 3.
Answers
Answered by
3
def reverse(s): str = "" for i in s: str = i + str return str
Answered by
4
In python 3,
//function definition
def intreverse(n):
rev=0
while ( n > 0 ):
last = n % 10
rev = rev * 10 + last
n = n / 10
return rev
Sample I/O:
intreverse(369)
963
Read more on Brainly.in - https://brainly.in/question/5520215
Similar questions