递归
public int factorial(int m)
{
if (m < 0)
return 0;
else if ( m == 1)
reteurn 1;
else if (m > 1)
return m * factorial(m-1);
}
非
public int factorial(int m)
{
if (m < 0)
return 0;
else if ( m == 1)
reteurn 1;
else if (m > 1)
{
int sum = 1
for (int i = 2; i <= m; i++)
sum = sum * i;
return sum;
}
}