#include <stdio.h>
int jc(int n)
{
int result;
if(n < 0)
{
printf("输入错误\n");
return 0;
}
else if(0 == n || 1 == n)
{
return 1;
}
else
{
result = jc(n-1)*n;
}
return result;
}
int main (){
int n;
printf("请输入一个整数:%d\n");
scanf("%d\n",&n);
printf("阶乘结果: %d\n",n,jc(n));
return 0;
}
昵称好难起757
慕的地6079101
慕用4063026
昵称好难起757
昵称好难起757
相关分类