1 long fact(int n) 2 { 3 if(n==0) 4 return 1; 5 else 6 return n*fact(n-1); 7 } 8 #include <stdio.h> 9 int main(int argc, const char *argv[]) 10 { 11 long y; 12 int m; 13 printf("输入一个数:"); 14 scanf("%d",&m); 15 y=fact(m); 16 printf("%d的阶乘为%ld",m,y); 17 return 0; 18 }
标签:return,递归,实现,long,int,printf,阶乘,fact From: https://www.cnblogs.com/xj123/p/17127477.html