2/21/2009

C Program To Find The Reverse Of The Given Number



/*C Program To Find The Reverse Of The Given Number*/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,rdig=0,rev=0,onum=0;
    printf("Enter the number: \n");
        scanf("%d",&n);
      onum=n;
     while(n!=0){
        rdig=n%10;
        rev=rev*10+rdig;
        n=n/10;
     }

      printf("Reverse Of The Given Number Is = %d\n",rev);
    return 0;
}
Out Put:
Enter the number:
123
Reverse Of The Given Number Is = 321

No comments:

Post a Comment