#include<iostream>
using namespace std;
int factorial(int n)
{
if (n == 0)
{
return 1;
}
else
{
return n * factorial(n - 1);
}
}
int main()
{
int result = factorial(10);
cout << "the result is:" << result << endl;
system("pause");
return 0;
}
021.计算阶乘(递归算法)
最新推荐文章于 2022-04-20 13:47:48 发布