parent
377dbf5d8d
commit
cc4dd0c110
@ -0,0 +1,18 @@
|
|||||||
|
#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;
|
||||||
|
}
|
Loading…
Reference in new issue