C Program to reverse number

Simple C program to reverse number.
#include<stdio.h>
int main()
{
 int a,n,reverse=0;
 printf("Enter a number: ");
 scanf("%d",&n);
 a=n;
 while(n!=0)
 {
  reverse=reverse*10;
  reverse=reverse+n%10;
  n=n/10;
  }
  printf("Reverse number of %d = %d",a,reverse);
  return 0;
}




Popular posts from this blog