This program that I wrote is supposed to get 3 sets of 5 numbers from the user and get the average of each set, but it's not getting the correct average for some numbers.

Here's the code:

If, for instance, I enter all "1"s it says the average of them is 2 (which is obviously incorrect). What is wrong here? It doesn't seem like anything is wrong, and I've tried two other ways of getting and reporting the average.Code:#include <stdio.h> #define ROWS 3 #define COLS 5 double store(double st[][5]); double average(double av[][5]); main() { double ar[3][5]; //10 printf("Please enter 3 sets of 5 double numbers:\n"); store(ar); average(ar); return 0; } double store(double st[][5]) { int i, n; //20 char c; for (n = 0; n < ROWS; n++) { printf("Enter 5 numbers for row %d:\n", n + 1); for (i = 0; i < COLS; i++) scanf("%d", &st[n][i]); c = getchar(); } } double average(double av[][5]) { int i, n; double total; for (n = 0; n < ROWS; n++) { total = 0; for (i = 0; i < COLS; i++) total += av[n][i] / COLS; printf("The average of the numbers in set %d is %d\n", n + 1, total); } }

And one more thing, what is EOF? I've seen it described a few times---in books and on the internet---but I just don't understand what it is. For example, how does a loop with a test condition of something being compared to EOF end, besides pressing Ctrl+D or Ctrl+Z or something like that? What exactly is the use of EOF?