average calculator of an array