c语言练习26——用递归法求n!

#include
#include
//题目:用递归法求n的阶乘
int main(){
int n;
long int s,a;
while(1){
printf("请输入参数n:");
scanf("%d",&n);
    s=1;
    for(a=1;a<=n;a++)
    s=s*a;
printf("%d!=%ld\n________________________________\n",n,s);
}
return 0;
}
   

 

转载于:https://www.cnblogs.com/gougouwang/p/11411965.html

你可能感兴趣的:(c/c++)