Displaying the number of elements larger than the average of an array I have to write a program in C that reads an array with n elements and then displays how many elements are bigger than the average of the elements of the vector.

Is there any other way to do this in a shorter or simpler way?

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

#define SIZE 100

void readArray(int [] , int );
double findAverage(int [] , int);
int countAboveAverage(int [] , int , double);

int main(int argc, char* argv []) {
//declare an array of size 100
int arr[SIZE];
int n;

printf("Enter a value for n: ");
scanf("%d", &amp;n);

if(n==0) {
fprintf(stderr, "Your size of n is too big. Run the program again.\n");
exit(1);
}
//this function will do the reading
readArray(arr, n);
//this is a function to find the average
double average = findAverage(arr, n);
//this is a function that will count the number above average
int count = countAboveAverage(arr, n, average);

printf("The number of elements above the average is %d:");

return EXIT_SUCCESS;
}

void readArray(int arr[], int n) {
int i;
for(i=0; i&lt;n; i++) {
printf("Please enter #%d: ", i+1);
scanf("%d", arr + i); /* or &amp;arr[i] */
}
}

double findAverage(int arr[], int n) {
int sum = 0;
int i;
for(i=0; i&lt;n; i++)
sum+=arr[i];
return (double)sum / n;
}

int countAboveAverage(int arr[], int n, double average) {
int count=0;
int i;

for(i=0; i&lt;n; i++)
count = arr[i] &gt; average ? count+1: count;
return count;
}
A few extra comments:


define main at the bottom so that prototypes are unnecessary
define local functions 'static'
if you are going to use EXIT_SUCCESS then also use EXIT_FAILURE
your comments are just noise (no useful information) and should be deleted
add a \n at the end of the final printf  (which is missing count)
you don't check for n being greater than SIZE, only for zero (although
the error printf says n is too big)
define loop variables in the loop and always use braces, even when not necessary:

for (int i=0; i&lt;n; ++i) {
    // do something
}

findAverage and countAboveAverage should declare arr as const

static double findAverage(const int arr[], int n);

personally I'd avoid using unsigned types (suggested by @Sulthan) as it often
leads to unexpected arithmetic results.  If you do use it, make sure you
enable the necessary compiler warnings.