array #3 fixed

fixed the function for question 3 in arrays.