用for语句编写n!
用for语句编写n!
在TC2.0上通过
#include<stdio.h>
void main()
{
int i,sum,n,m;
printf("please input n\n");
scanf("%d",&n);
sum=1;
m=n;
for(i=m;i>=1;i--)
{
sum=sum*n;
n--;
}
printf("the result is %d\n",sum);
}