long fact(int n)//无限套娃直到"1"
{
long f;
if (n == 1)
f = 1;
else
f = n * fact(n - 1);
return(f);
}
int main()
{
long y;
int m;
cout << "请输入一个正整数:" << endl;
cin >> m;
y = fact(m);
cout << m << "!=" << y << endl;
system("pause");
return 0;
}
递归函数_
最新推荐文章于 2024-08-22 17:27:46 发布