0
How to reverse a number using pointer
pointers
3 Answers
+ 1
consider giving an upvote?
0
\* C Program to to reverse a number using pointer *\
# include < stdio.h >
int  main( ) {
int  num, rem, rev=0 ;
int  *pn, *pr ;
printf(" Enter the number : ")Â ;
scanf("%f ",& num)Â ;
pn = & num ;
pr = & rev ;
do {
rem = ( *pn ) % 10Â ;
*pr = ( *pr * 10 ) + rem ;
*pn = ( *pn ) / 10Â ;
} while(Â *pn > 0);
printf("\n Reverse of Number is : %d ",*pr)Â ;
return ( 0 );
}
0
wahh