Question #342882

Find the error(s) in each of the following program segments and explain how the error(s) can be corrected: 

(iii) int computeProd(int n) { if (n == 0) return 0; else } n * computeProd(n – 1)


Expert's answer

 int computeProd(int n) { 
     if (n == 1) return 1;
     return n * computeProd(n-1);
 } 
LATEST TUTORIALS
APPROVED BY CLIENTS