Time Exceeded
代码
#include<stdio.h>
int factorial (int n);
int main()
{
int n;
scanf("%d",&n);
while (n<=0)
{
scanf("%d",&n);
if(n>0) break;
}
printf("%d \n",factorial(n));
return 0;
}
int factorial(int n)
{
int i,fact=1;
for(i=1;i<=n;i++)
fact = fact*i;
return fact;
}