You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Flower/Untitled1.cpp

19 lines
250 B

#include<stdio.h>
int factorial(int n)
{
if(n==0)
return 1;
return n*factorial(n-1);
}
int main()
{
int n,x;
printf("请输入你想要求的阶乘的数:");
scanf("%d",&n);
x=factorial(n);
printf("%d的阶乘是%d\n",n,x);
return 0;
}