title: Calculate the average of an array with a recursive function
body: <p>How would you write a recursive function that calculates the average of the elements of an array?</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>int media(int numeros[], int i, int n) {
      if (i == n-1) return numeros[i]/n;  
      return numeros[i]/n + media(numeros, i + 1, n); 
  }
  </code></pre>
  
  <p>But it doesn't work, and I think it's because of the line: <code>if (i == n-1) return numeros[i]/n;</code></p>