Write a program in C to reverse a number by recursive
function?
Answer / 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 |
What is the difference between declaring a variable by constant keyword and #define ing that variable?
Will Macros support multiple arguments ?
what is object oriental programing?
main() { int i; for(i=0;i<5;i++) printf("%d",1l<<i); } why doesn't 'l' affect the code??????
errors in computer programmes are called
What are the advantages and disadvantages of pointers?
Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
How can you read a directory in a C program?
What is the difference between constant pointer and pointer to a constant. Give examples.
How can I sort a linked list?
What is difference between structure and union in c?