Help me with writing a program that calculates the average value of the elements of a 1-
dimensional array of size N.

We require proof of effort when helping with homework questions. What have you done so far? Do you know how to calculate the average of N numbers manually? Do you know how to create and populate an array?

Average:

total = 0;
for (i = 0 i < N; i++)
{
    total += array[i]; i++)
}
avg = total/N;

You get to figure out the coding errors... :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.