C program to print reverse of a number using while loop

C program to print reverse of a number using while loop. This program is to reverse the number and print in the output screen in c programming. To print the number in reverse using the while loop in c langugage. 

#include <stdio.h>
int main()
{
int n, rev = 0, rem;
printf("Enter the number ");
scanf("%d", &n);
while (n != 0)
{
rem = n % 10;
rev = rev * 10 + rem;
n /= 10;
}
printf("reversed number is %d", rev);
return 0;
}
Output:
Enter the number 56789 
reversed number is 98765