#include <stdio.h>
#include <stdlib.h>
int factor(int n)
{
int ret = 1;
int i = 1;
for (; i <= n; ++i)
{
ret *= i;
}
return ret;
}
int main()
{
printf("%d", factor(5));
system("pause");
return(0);
}
c语言练习题:用函数求n的阶乘
最新推荐文章于 2024-05-31 19:42:50 发布