Sunday, January 10, 2010

With what do you replace the ???? to make the function shown below return the correct answer?

long factorial (long x)
{
????
return x * factorial(x - 1);
}

a) if (x == 0) return 0;
b) return 1;
c) if (x >= 2) return 2;
d) if (x == 0) return 1;
e) if (x <= 1) return 1;

No comments: