Tuesday, June 5, 2007

Question 12

The function fact(n) returns the n factorial n! for the non-negative integer n. Which is the recursive definition for fact(n)?

a. if n=0 then return 0 else return n*fact(n-1);
b. if n=0 then return 0 else return n*fact(n+1);
c. if n=0 then return 1 else return n*fact(n-1);
d. if n=0 then return 1 else return n*fact (n+1);

answer

No comments: