编辑代码

using namespace std;
int factorialbyRecurse(int n)
{
	if(n==1)
	{
		return 1;
	}
	else {
		return n*factorialbyRecurse(n-1);
	}
}
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;
}