# Challenge 1: Average of Numbers

Given an array of numbers, compute the average of those numbers recursively.

## We'll cover the following

## Problem Statement

Implement a function that computes the average of all the numbers in an array.

If we have $n$ numbers and each number is denoted by $a_i$ $(where \: i = 0, 1, 2, ..., n-1)$, the average is the $sum$ of the numbers divided by $n$. This is represented as follows:

$$$$

${{average}}={\frac {1}{n}}\sum _{i=0}^{n-1}a_{i}={\frac {a_{0}+a_{1}+a_{2}+\cdots +a_{n-1}}{n}}$

Try solving this problem recursively.

### Input

- A
`testVariable`

containing an array of numbers. - The
`currentIndex`

of the array.

### Output

Average of all numbers in the input array.

### Sample Input

```
testVariable = [10, 2, 3, 4, 8, 0]
currentIndex = 0
```

### Sample Output

```
4.5
```

### Try it Yourself

Try this challenge yourself before examining the solution. Good luck!

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.