Write a program in C to reverse a number by recursive
function?
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>10)//456
{
a=a/10;//a=45
b=b*10+a%10;//65
return rev(a,b);
}
else
return b;
}
| Is This Answer Correct ? | 17 Yes | 7 No |
Post New Answer View All Answers
How to create struct variables?
Distinguish between actual and formal arguments.
Can a pointer be null?
hi any body pls give me company name interview conduct "c" language only
What is NULL pointer?
What is function prototype in c with example?
What is chain pointer in c?
What does c mean?
Can a variable be both constant and volatile?
what is event driven software and what is procedural driven software?
How can I manipulate individual bits?
What is a floating point in c?
What are the general description for loop statement and available loop types in c?
Difference between strcpy() and memcpy() function?
Explain low-order bytes.