#include <stdio.h>
long fac(int num);
int main(void)
{
int num;
printf("输入一个正整数:");
scanf("%d",&num);
printf("%d的阶乘是:%d",num,fac(num));
return 0;
}
long fac(int num)
{
long result;
if(num<2)
return 1;
else
return num*fac(num-1);
}
追问不对
追答你确定不对???以下是运行截图:
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/14ce36d3d539b6001378111aee50352ac75cb7ec?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)