#include<stdio.h>
int f(int n)
{
if(n==1)
{
return 1;
}else{
return n*f(n-1);
}
}
int main()
{
//求n的阶层
int n;
printf("你需要求哪个数的阶层呢?\n");
scanf("%d",&n);
int res;
res= f(n) ;
printf("答案为%d",res);
return 0;
}
标签:阶层,return,递归,int,res,printf
From: https://www.cnblogs.com/swtaa/p/17706298.html