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

Why clrscr is used in c?

1014


What is c language and why we use it?

1068


What is string constants?

1141


Explain what is the benefit of using an enum rather than a #define constant?

1216


Can we access the array using a pointer in c language?

1043


What is the use of getchar() function?

1125


Is null a keyword in c?

1193


What does the format %10.2 mean when included in a printf statement?

1645


What do you understand by friend-functions? How are they used?

1203


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2422


What is the use of pragma in embedded c?

1049


What is hashing in c?

1162


Explain a file operation in C with an example.

1116


Explain union.

1166


What is the correct code to have following output in c using nested for loop?

1076