本题题解
2025-10-26 22:14:04
发布于:江苏
6阅读
0回复
0点赞
#include<iostream>
using namespace std;
int f(int x){
if(x==0)
return 1;
return x*f(x-1);
}
int main(){
int n;
cin>>n;
cout<<f(n);
return 0;
}
其实这题并没有很复杂
注解:return 1这一步一定不能少不然会运行错误。PS:个人比较喜欢变量名都设成小写字母
这里空空如也

有帮助,赞一个