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 that finds the factorial of a number using
recursion?

Answer Posted / prasenjit banik

#include<iostream.h>
#include<conio.h>
void main()
{
int n,fact;
int rec(int); clrscr();
cout<<"Enter the number:->";
cin>>n;
fact=rec(n);
cout<<endl<<"Factorial Result are:: "<<fact<<endl;
getch();
}
rec(int x)
{
int f;
if(x==1)
return(x);
else
{
f=x*rec(x-1);
return(f);
}
}

Is This Answer Correct ?    14 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

1043


What is malloc() function?

1175


What is #include cctype?

1133


What is the role of && operator in a program code?

1084


How can I read a binary data file properly?

1184


What are qualifiers in c?

1044


Explain how do you determine the length of a string value that was stored in a variable?

1163


Suggesting that there can be 62 seconds in a minute?

1052


Difference between macros and inline functions? Can a function be forced as inline?

1289


Do you have any idea about the use of "auto" keyword?

1095


What functions are used for dynamic memory allocation in c language?

1161


Hai what is the different types of versions and their differences

1948


Explain how can I convert a number to a string?

1161


Is it better to use malloc() or calloc()?

1131


How do you list files in a directory?

1156