C Program to Find Reverse of a Given Number

Program


#include<stdio.h>
#include<conio.h>

int main()
{
	 long int number, reverse=0, rem, original;
	 clrscr();
	 printf("Enter number: ");
	 scanf("%ld", &number);
	
	 original = number;
	
	 while(number!=0)
	 {
	  rem = number % 10;
	  reverse = reverse*10 + rem;
	  number = number/10;
	 }
	 printf("Reverse of %ld is %ld", original, reverse);
	 getch();
	 
	 return(0);
}

Output of the above program :

Enter number: 67859 ↲
Reverse of 67859 is 95876

Note: ↲ indicates enter is pressed.