#include <stdio.h>
int factorial(int x)
{
if (x <= 1)
return 1;
else
{
x = x * factorial(x - 1);
return(x);
}
}
int main()
{
int n,m;
printf("请输入n:");
scanf_s("%d", &n);
if (n <= 0 )
printf("输入错误");
else
{
int factorial(int x);
m= factorial(n);
printf("%d", m);
}
return 0;
}
标签:return,函数,递归,int,else,factorial,printf,阶乘,输入 From: https://blog.51cto.com/u_16336886/8551060