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 we wont use '&' sing in aceesing the string using scanf
How can I write functions that take a variable number of arguments?
Why static is used in c?
What is data structure in c language?
what are the stoge class in C and tel the scope and life time of it?
How can I invoke another program from within a C program?
what is the output of printf("%d",(scanf("%d",10));
Give a method to count the number of ones in a 32 bit number?
Was 2000 a leap year?
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }
27 Answers Advent Global Solutions, CitiGroup, Valeo Lighting Systems India Private Limited, Vishal Transformers, Wipro, Zencer,
how can i sort numbers from ascending order and descending order using turbo c..
Will Macros support multiple arguments ?