Question about c programming


Write a C program to find the closest element to the average value of an array of some integers. If there exist more than one closest elements in the array, print the closest element which is present at the higher array-index. The array must be represented through a pointer (with DMA). In the program, define a separate function to find the closest array element.
Input Format

The inputs to the program are (i) a positive integer indicating the no. of array elements, and (ii) positive integers indicating the array elements (separated by a space)



Output Format

The output of the program is a positive integer present in the array.

Sample Input 0

5 4 1 3 2 6

Sample Output 0


Explanation 0

Here, 3 is the closest array element to the average (3.2) of the array.
Please help me with this program as soon as possible.
Thank you.

Is that your assignment?
Is today the last day to submit?