Math, asked by Bunisia1397, 11 months ago

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 imhkp4u
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 topanswers
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