Question about C programminng

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)

Constraints

0

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

3

Explanation 0

Here, 3 is the closest array element to the average (3.2) of the array.

please me with this asap

Hello, @vishwajeetsuryawansh. Welcome to the forums. This looks like a homework assignment. If you would like help, you need to ask a specific question. For example, if you have some code you’ve started, you could post it, and ask a question about it. We don’t do others’ homework for them on this site.

3 Likes