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 do you mean by inline function in C?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
List the difference between a "copy constructor" and a "assignment operator"?
Why does everyone say not to use gets?
How can I read and write comma-delimited text?
What are local static variables?
What is an auto keyword in c?
What does printf does?
#include
How can I write functions that take a variable number of arguments?
Define and explain about ! Operator?
Can we declare variables anywhere in c?
Can you mix old-style and new-style function syntax?
How can I swap two values without using a temporary?
Is fortran faster than c?