Answer to Question 14C-2

  1. product(A, 0) = 1

  2. When n > 0, product(A, n) = product(A, n−1) * A[n].

Check that the second equation is true on some examples, including an example where n = 1.

Converting those facts to a definition of product yields the following.

  int product(const int A[], const int n)
  {
    if(n == 0)
    {
       return 1;
    }
    else
    {
       return product(A,n-1) * n;
    }
  }