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
Why do we use int main instead of void main in c?
What is the use of function overloading in C?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
How can I swap two values without using a temporary?
Why flag is used in c?
how to find binary of number?
Is c easier than java?
Can a local variable be volatile in c?
How do you define a function?
How are Structure passing and returning implemented by the complier?
When should you not use a type cast?
When should volatile modifier be used?
What is abstract data structure in c?
Explain the difference between ++u and u++?
Write a program on swapping (100, 50)