Untitled

 avatar
user_7016102
plain_text
21 days ago
286 B
2
Indexable
Never
//LAB 6
#include<iostream>
using namespace std;
int fact(int n)
{
	if(n==0||n==1)
	{
		return 1;
	}
	else{
		return n*fact(n-1);
	}
}
int main()
{
	int n;
	cout<<"Enter the number : ";
	cin>>n;
	cout<<"The factorial of "<<n<<": "<<endl;
	cout<<fact(n);
	return 0;
}
Leave a Comment