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 are pointers? What are different types of pointers?
In a byte, what is the maximum decimal number that you can accommodate?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
Why cant I open a file by its explicit path?
Is return a keyword in c?
What is file in c language?
Difference between Shallow copy and Deep copy?
Define and explain about ! Operator?
How can I write functions that take a variable number of arguments?
What does c value mean?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
c language interview questions & answer
How to define structures? ·
What do you mean by Recursion Function?
How variables are declared in c?