求单个数阶乘以5为例。
#include <iostream> using namespace std; int main() { int n,i,s=1; cin>>n; for(i=1;i<=n;i++)//for循环求累积 s=s*i; cout<<s; return 0; }