#include <stdio.h>
int factorial(int n)
{
int result;
if (n < 0)
{
printf("%s\n", "输入错误");
return 0;
}
else if (n == 0 || n == 1);
{
result = 1;
}
else (n > 1)
{
result = factorial(n - 1)*n;
}
return result;
}
int main()
{
int n = 5;
printf("%s\n", "%d的阶乘=%d", n, factorial(n));
return 0;
}
噼喱啪啦
人在梦游中
叉哥睡不醒
霏梧
rootclass
相关分类