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 a function simple definition?
Where we use clrscr in c?
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
How to define structures? ·
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE?
Explain the bubble sort algorithm.
Write a program to give following output..... ********* **** **** *** *** ** ** * * ** ** *** *** **** **** *********
If you know then define #pragma?
Explain what is a 'locale'?
What happens if a header file is included twice?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
What is the difference between near, far and huge pointers?