how to find out the reverse number of a digit if it is
input through the keyboard?
Answer Posted / sreejesh1987
int rev(int,int);
void main()
{
int a,b;
clrscr();
printf("\nEnter the number to reverse:");//456
scanf("%d",&a);
b=a%10;//b=6
printf("\nReverse of the number is: %d",rev(a,b));
getch();
}
int rev(int a,int b)
{
if(a>9)//456
{
a=a/10;//a=45
b=b*10+a%10;//65
return rev(a,b);
}
else
return b;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is uint8 in c?
When should the register modifier be used? Does it really help?
Is it possible to have a function as a parameter in another function?
What is a char in c?
How can I open a file so that other programs can update it at the same time?
Why main is used in c?
Why is c so powerful?
What are loops in c?
What is storage class?
What does it mean when a pointer is used in an if statement?
What are structure types in C?
What is string in c language?
Explain Basic concepts of C language?
What is a const pointer in c?
Explain how can I convert a string to a number?