【发布时间】:2016-02-24 16:49:09
【问题描述】:
我编写的程序没有给出正确的结果。
main()
{
int i=1,n,s=1;
printf("enter the value of n");
scanf("%d",&n);
while(i<=n)
{
s=s*i;
i++;
if (i==n+1)
{
break;
}
}
printf("factorial of n=",s);
}
它给出的结果如下图所示。
【问题讨论】:
-
不要发布文字图片!
-
你没有打印
s的值。