用for循环和递归的方法计算10的阶乘
include <stdio.h>
int jc (int num);
int jc2 (int num);
int main()
{
int n;
n = jc(10);
printf("%d\n", n);
}
int jc (int num)
{
int j = 1, i;
for (i = 1; i <= num; i++){
j *= i;
}
return j;
}
int jc2 (int num)
{ int j;
if (num > 1) {
j = jc2(num - 1) * num;
} else {
j = 1;
}
return j;
}