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 |
Why c is called top down?
Explain what is meant by high-order and low-order bytes?
What is the difference between the = symbol and == symbol?
Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
What are multibyte characters?
can v write main() { main(); } Is it true?
What is operator promotion?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
What is the explanation for modular programming?
Are pointers integer?
i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k);
Why do we need functions in c?