by Dinesh Thakur

In this program user ask to reverse the 10 digit number. To reverse the digit user declares the variables for storing the value in it so far. User asks to put out the 10 digit value on double quoted premises. The after user declare the while condition while (a!=0). Then if the given condition rely on the situation the variable b=a%10. Then after user print out the result on the screen.

Problem Statement:
This is C program that asks user to reverse a 10 digit number.

  1. Declare variable.
  2. Using the while condition.
  3. Display result on the screen.

Here is C source code for reversing the 10 digit number. Output of this program shown below. 

#include <stdio.h>

#include <conio.h>
void main ()
{
    long int a,b,r=0;
    clrscr();
    printf ("\nInput a 10 Digit Number : ");
    scanf ("%ld",&a);
    while (a!=0)
        {
                 b=a%10;
                 r=(10*r)+b;
                 a=a/10;
        }
    printf ("\nThe Reverse of the Number is : %ld",r);
    getch();
}
Output :
Input a 10 Digit Number : 1234567890
The Reverse of the Number is : 987654321