Write a program in C to reverse a number by recursive
function?
Answer / 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>10)//456
{
a=a/10;//a=45
b=b*10+a%10;//65
return rev(a,b);
}
else
return b;
}
| Is This Answer Correct ? | 17 Yes | 7 No |
What character terminates all strings composed of character arrays? 1) 0 2) . 3) END
Three major criteria of scheduling.
Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.
What is the difference between if else and switchstatement
i need all types of question paper releted to "c" and other language.
why we shiuld use main keyword in C
What is the difference between formatted&unformatted i/o functions?
What are data breakpoints?
Which header file is used for clrscr?
Write a c program to print the even numbers followed by odd numbers in an array without using additional array
How to add two numbers with using function?
here is a link to download Let_Us_C_-_Yashwant_Kanetkar