Saturday, October 03, 2015

Write a program to reverse an integer number. (Hint: if number is 135, it should be displayed as 531)

Solution:-
     #include<stdio.h>
     #include<conio.h>
     void main( )
     {
             clrscr( );
             long int num,rem;
             printf("Enter the integer number: \n");
             scanf("%ld",&num);
             while( num ! = 0 )
             {
                       rem = num % 10 ;
                       printf("%ld",rem);
                       num=num/10;
              }
              getch( );
     }