#include <iostream>
using namespace std;
int factorial(int n)
{
if (n == 1)
return 1;
return n * factorial(n - 1);
}
int main()
{
int num = 1;
cin >> num;
cout <<factorial(num) << endl;
return 0;
}
运用递归函数求n阶乘
最新推荐文章于 2024-11-04 23:24:03 发布