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

谢谢了啊
2024年11月29日 09:33
有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):

能问下用哪种语言吗?