Reverse of a number


Write a C program to find reverse of a number.


#include<stdio.h>
#include<conio.h>
void main()
{
  int  n , rev=0 , r , temp ;
  printf("Enter a number: ") ;
  scanf("%d" , &n) ;
  temp=n ;
  while(n!=0)
  {
    r=n%10 ;    /* Extract the last digit */
    rev=rev*10+r ;  /* Find reverse */
    n=n/10 ;    /* Reduce number by 1 digit */
  }
  printf("Reverse of %d is %d" , temp , rev) ;
}

Output :

Output