代码:
#include<iostream>
using namespace std;
int fact(int n);
int main()
{
int n;
loop:
cin >> n;
cout << fact(n);
goto loop;
}
int fact(int n)
{
if (n == ) //递归终止条件
{
return ;
}
return n * fact(n - );
}
2021-12-27 13:31:23
代码:
#include<iostream>
using namespace std;
int fact(int n);
int main()
{
int n;
loop:
cin >> n;
cout << fact(n);
goto loop;
}
int fact(int n)
{
if (n == ) //递归终止条件
{
return ;
}
return n * fact(n - );
}