Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 43: Write a C++ program to print factorial of a number by using recursion.

using namespace std;

int fact(int n)
	return n;
	return n*fact(n-1);

int main()
	int num;
	cout<<"\nenter a number : ";
	cout<<"\nfactorial of a given number : "<<fact(num);
	return 0;

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.