can some body tell , how to write function which calculates average of all the elements of the 2D array