to find out the reverse digit of a given number
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>9)//456
{
a=a/10;//a=45
b=b*10+a%10;//65
return rev(a,b);
}
else
return b;
}
| Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
What is use of bit field?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
How do shell structures work?
What is c value paradox explain?
Describe the difference between = and == symbols in c programming?
What is pre-emptive data structure and explain it with example?
How can I sort more data than will fit in memory?
provide an example of the Group by clause, when would you use this clause
Why is #define used?
Why c is called procedure oriented language?
How can I delete a file?
Why ca not I do something like this?
Explain about C function prototype?
Which header file is essential for using strcmp function?
What does void main () mean?