This c program takes an integer as input, stores the original number in a separate variable, and then reverses the digits of the number using a while
loop. The reversed number is then displayed on the screen along with the original number.
Program :
#include<stdio.h>
#include<conio.h>
main()
{
int n,r=0;
printf(“Enter a number to reverse : “);
scanf(“%d”,&n);
while(n!=0)
{
r=r*10;
r=r+n%10;
n=n/10;
}
printf(“Reverse of Entered Number is = %d\n”,r);
}
Output :
