编写程序,输入正整数n,计算它的阶乘n!(n!=nx(n-1)x…x3x2x1)

谢谢了啊
2024-11-29 09:33:51
推荐回答(3个)
回答1:

*********您好!Yadie.23很高兴能为你解答。*********
+++++++++++++++++++++++++++++++++++++++++++++++++代码很简单,我更愿意帮你检查你的代码,给些意见。。+++++++++++++++++++++++++++++++++++++++++++++++++
You can have a try,maybe my answer useful to you.
如满意,Yadie.23十分感谢您的采纳。*^-^*

回答2:

#include int main()
{
int i,n;
long sum = 1;
printf("input a number:");
scanf("%d",&n);
if( n == 0)
printf("%d != 1",n);
else
for(i = 1;i <= n;i ++)
sum *= i;
printf("%d! = %ld \n",n,sum);
}

回答3:

能问下用哪种语言吗?