how to find out the reverse number of a digit if it is
input through the keyboard?
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 ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do you use a pointer to a function?
What's the total generic pointer type?
How can I automatically locate a programs configuration files in the same directory as the executable?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
How can I trap or ignore keyboard interrupts like control-c?
What do you mean by invalid pointer arithmetic?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
State the difference between realloc and free.
Are local variables initialized to zero by default in c?
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What is pragma in c?
What is structure and union in c?
How does struct work in c?
Explain what standard functions are available to manipulate strings?
List the difference between a 'copy constructor' and a 'assignment operator' in C?