If a five-digit number is input through the keyboard, write a program in C to reverse the number

            #include <stdio.h>
            #include <conio.h>
            void main()
            {
                        int a,b,c,d,e,f,g; clrscr();
                        printf("Enter a five digit number ; "); scanf("%d", &a);
                        b=a/10000;
                        c=a%10000/1000;
                        d=a%10000%1000/100;
                        e=a%10000%1000%100/10;
                        f=a%10000%1000%100%10;
                        printf("b%d c%d d%d e%d f%d",b,c,d,e,f);
                        g=(f*10000) + (e*1000) + (d*100) + (c*10) + b;
                        printf("\n\nReversed number : %d", g);
                        getch();
            }


Post a Comment