Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to create struct variables?

1066


Distinguish between actual and formal arguments.

1028


Can a pointer be null?

988


hi any body pls give me company name interview conduct "c" language only

2254


What is NULL pointer?

1050


What is function prototype in c with example?

1024


What is chain pointer in c?

1022


What does c mean?

993


Can a variable be both constant and volatile?

1069


what is event driven software and what is procedural driven software?

2518


How can I manipulate individual bits?

1003


What is a floating point in c?

1031


What are the general description for loop statement and available loop types in c?

1088


Difference between strcpy() and memcpy() function?

1092


Explain low-order bytes.

994