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
What is a dynamic array in c?
Write a program to print numbers from 1 to 100 without using loop in c?
What are file streams?
I have seen function declarations that look like this
What is the purpose of void in c?
Explain the process of converting a Tree into a Binary Tree.
What is the ANSI C Standard?
Explain the difference between the local variable and global variable in c?
How are variables declared in c?
Is multithreading possible in c?
Which is better pointer or array?
How can I recover the file name given an open stream?
What is scanf () in c?
What are the data types present in c?
What is call by reference in functions?