In this program user ask to reverse the Entered number. User declares the required variables for storing the value. User asks to enter the number. User declares the loop statement for reversing the number. Here user also declares the swapping method for this convention like b=a%10, c=a/10, a=c. printing out the condition on display as result on the mark.
Problem Statement:
This is C program that asks user to reverse the entered Number.
- Declaring the variables.
- Using loop statement.
- 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;
int b,c,i;
clrscr();
printf("This will Reverse the Entered number : \n");
printf("Please Enter the Five Digit Number : \t");
scanf("%ld",&a);
for(i=1;i<=5;i++)
{
b=a%10;
c=a/10;
a=c;
printf("%d ",b);
}
getch();
}