Question 1. Assume that an n-element array (vector)
a contains distinct integers arranged in no
particular order. Write an algorithm to find the value and
location of (a) the mean of a and (b) the value v in
a closest to the mean. Note: If v equals the
mean, then v is the value closest to the mean.
Example. If a = (1,2,3,5,4,6,7,9), then the
mean equals 37/8 = 4.625. The value 5, which is in the
fourth location (i = 4), happens to be the value closest
to the mean.