Write a program in C to reverse a number by recursive
function?
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>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 |
Post New Answer View All Answers
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What are directives in c?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is strcpy() function?
Explain what is the general form of a c program?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
How can you determine the size of an allocated portion of memory?
Write a program to reverse a given number in c?
Explain the use of #pragma exit?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
how to build a exercise findig min number of e heap with list imlemented?
What is a void * in c?
Can you write the algorithm for Queue?
What is the size of empty structure in c?
Is c still relevant?