编辑代码

using namespace std;
int factorialbyRecurse(int n)
{
	if(n==1)
	{
		return 1;
	}
	else {
		int a=0;
		int b=2;
		int c=1;
		int d=3;
		for(;d<n+1;++d)
		{
			a=b+c;
			b=c;
			c=a;
		}
		return a;
	}
}
int factorial(int n)
{
	int ret=1;
	for(int i=1;i<=n;++i)
	{
		ret=ret*i;
	}
	return ret;
}
int main() {
    int n;
	cin>>n;
	cout<<"Loop"<<n<<"!:"<<factorial(n)<<endl;
	cout<<"Recurse"<<n<<"!:"<<factorialbyRecurse(n)<<endl;
	return 0;
}