Given an input of a 2D array of integers, input the integers and calculate the average of the top half and the bottom half of the array. The first line of the input will consist of two integers N and M, denoting the number of rows and columns of the array respectively. The next N lines will contain M integers separated by space. Your program should read these integers in, store them in a 2D array, and then calculate the average of the numbers stored in the first N / 2 rows, then calculate the average of the numbers stored in the last N / 2 rows. N will be even. Output both of these averages.
Please reply to this post with your solution.