Program to reverse a number in c


Example

#include<stdio.h>
#include<conio.h>
void main()
{
    long int a;
    int b,c,i;
    clrscr();
    printf("Please Enter the Five Digit Number : \t");
    scanf("%ld",&a);
    for(i=1;i<=5;i++)
        {
            b=a%10;
            c=a/10;
            a=c;
            printf("%d ",b);
        }
    getch();
} 
                                


Output

Please Enter the Five Digit Number : 1 2 3 4 5
5 4 3 2 1