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 to set file pointer to beginning c?
What are the advantages and disadvantages of c language?
When can a far pointer be used?
Why is it that not all header files are declared in every C program?
Explain what is the difference between text files and binary files?
What is string function c?
In C programming, what command or code can be used to determine if a number of odd or even?
How many types of functions are there in c?
Explain what is a pragma?
What are the different properties of variable number of arguments?
What is the explanation for cyclic nature of data types in c?
Why is c called c not d or e?
What does %d do?
What is identifier in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?