C语言 采用递归设计一个求n!的函数。

代码:
#include <stdio.h>
int tc(int n)
{
int i,s=1;
for(i=1;i<=n;i++)
s=s*i;
return s;
}

void main(){
int n;
printf(“Input n:”);
scanf("%d",&n);
printf("!%d=%d\n",n,tc(n));
}

输出结果:
C语言 采用递归设计一个求n!的函数。

相关文章:

  • 2021-08-20
  • 2021-11-11
  • 2021-11-28
  • 2021-06-05
  • 2021-04-29
  • 2021-04-15
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2021-07-14
  • 2022-12-23
  • 2021-09-28
  • 2021-12-10
  • 2021-12-10
相关资源
相似解决方案