Program to find the reverse of a Number

 

Program



#include <stdio.h>
void main()
{  
  int n,r;
  printf("\n Enter the Digit to reverse");
  scanf("%d",&n);
  while(n>0)
  {
  
    //Generate the remainder of input, dividing it by 10
  
  r=n%10;
  printf("%d",r);
  n=n/10;
  }  
}


Input

56789

Output

98765

Comments