c-programs-basics
We are going to write a c program to take a number as an input and reverse that number. We can do this by reversing each single digits of the whole number.
Reverse The Number Using While Loop

#include<stdio.h>
#include<conio.h>
void main()
{

 long int a,rev,d;
 clrscr();

 printf("\n **************************");

 printf("\n Enter Any Number: ");
 scanf("%ld",&a);

 rev=0;
 while(a!=0)
  {
    d=a%10;
    rev=rev*10+d;
    a=a/10;
  }

 printf("\n Reverse Number = %ld",rev);

 printf("\n **************************");

 getch();

}

Output :

Output-C-Program-To-Reverse-Number







In this way we can reverse a number using while loop in c programming.