莫回无
可以递归#include<iostream> using namespace std; int fac(int); int main(){ int n; while (cin >> n) { cout << n << "!= " << fac(n) << endl; } return 0;} int fac(int x) //递归函数 { int f; if (x == 0 || x == 1) f = 1; else f = fac(x - 1)*x; return f;}