P5739 【深基7.例7】计算阶乘 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
递归
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 2e7+10,M = 1e3+10;
double a[N];
int jie(int n)
{if(n==1)return 1;else return n*jie(n-1);
}
signed main()
{std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);int n;cin>>n;cout<<jie(n);return 0;
}