C Program to Display Reverse of given Number

C Program to Display Reverse of given Number:
If you are using any software then below program will not give an error, but if you are using TURBO C then you have to make some changes like: void main() and some function like clrscr() or getch().



#include<stdio.h>
 main()
 {
   int num,rem,rev=0;

   printf("Enter number to get reversed : ");
   scanf("%d",&num);

   while(num >= 1)
    {
      rem=num%10;
      rev=rev*10+rem;
      num=num/10;
    }

   printf("\nReverse Number is: %d",rev);
}

OUTPUT:

Enter number to get reversed : 1478953

Reverse Number is: 3598741

 

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 5 =