#include<bits/stdc++.h>
using namespace std;
int fac(int x){
if(x==0) return 1;
else return x*fac(x-1);
}
int main(){
int x;
cin>>x;
cout<<fac(x);
}
洛谷P5739 【深基7.例7】计算阶乘
最新推荐文章于 2025-05-04 17:28:18 发布
#include<bits/stdc++.h>
using namespace std;
int fac(int x){
if(x==0) return 1;
else return x*fac(x-1);
}
int main(){
int x;
cin>>x;
cout<<fac(x);
}