C program to print the given number in reverse order
Printing the number in Reverse Order
In this post, i had shared a c program that will help you guys to print the inputted number into reverse order.
For E.g. If the number is 123456789
Output will be: 987654321
#include <stdio.h>
#include <conio.h>
void main()
{
long int n,a=0;
clrscr();
printf("enter no.: ");
scanf("%ld",&n);
while(n!=0)
{
a=a*10;
a=a+(n%10);
n=n/10;
}
printf("\nReverse number is: %ld",a);
getch();
}
Happy Coding :)
Comments
Post a Comment