递归求一个数的阶乘
int Factorial(int x) // 阶乘函数
{
if (x <= 1)
return x;
if (x > 1)
{
return x * Factorial(x - 1);
}
}
int main()
{
while (1)
{
int a = 0;
printf("请输入一个正整数:");
scanf("%d", &a);
printf("%d\n", Factorial(a));
}
system("pause");
return 0;
}