#include < stdio.h >
#include < conio.h >
int findReverse(int number)
{
int reminder,sum=0;
while(number > 0)
{
reminder=number%10;
sum=sum*10+(reminder);
number=number/10;
}
return sum;
}
void main()
{
int number,reversenumber;
printf("Enter positive integer :");
scanf("%d",&number);
int tempnumber=number;
reversenumber=findReverse(number);
printf("The reverse Number of %d is %d\n",tempnumber,reversenumber);
}
Monday, January 12, 2009
C-code snippet to reverse a given number
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment