WRITE A PROGRAM USNG WHILE LOOP TO REVERSE THE DIGITS OF THE NUMBER.
Hint : use the modulus operator to extract the last digit and the integer division by 10 to get the n-1 digit number from the n digit number.
NO IS - 12345
ANS IS 54321
Answers
Answered by
0
Answer:
Program to find Reverse Number in C language.
Explanation:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,r,s=0;
clrscr();
printf("\n Enter The Number:");
scanf("%d",&n);
//LOOP FOR FINDING THE REVERSE OF A NUMBER
for(i=n;i>0; )
{
r=i%10;
s=s*10+r;
i=i/10;
}
printf("\n The Reverse Number of %d is %d",n,s);
getch();
}
Similar questions