用递归呗,输入的歼数数求册改毁阶乘
#include
int Fun(int a1);
int main(void)
{
int a;
scanf("%d",&a);
printf("州备%d\n",Fun(a));
return 0;
}
int Fun(int a1)
{
int s=0;
if (a1==0||a1==1) {
s=1;
}
else
s=a1*Fun(a1-1);
return s;
}
到底输入几个嘛,又是任意多,又是100个
int n = 0, i;
float shuZi = 0, chengJi = 1;
printf("输入你要计算多少个数:\n");
scanf("%d"大郑, &n);
for (i = 0; i < n; i++) {
printf("滚或颂输入数字:\n");
scanf("团拿%f", &shuZi);
chengJi *= shuZi;
}
printf("积:%.2f\n", chengJi);