Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
Answers
Answered by
0
Sourcecode:
main()
{
int x,y=0,r;
printf("enter the number : ");
scanf("%d",&x);
while(x!=0){
x=x%10;
y=y*10+r;
x=x/10;
}
printf("After reversing the number is %d",y);
}
if you have any doubt understanding this code then please ask.
Answered by
0
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
Political Science,
6 months ago
Physics,
6 months ago
Math,
6 months ago
Chemistry,
11 months ago
Math,
1 year ago