Solved exercise 10 from arrays