#include <stdio.h>
main()
{
int i;
int x[16] = { 80, 75, 72, 65, 95, 79, 88, 82, 70, 75, 88, 95, 98, 56, 81, 87};
float sum = 0, count = 0;
for (i = 0; i < 16; ++i){
if (x[i]%2 == 1)
x[i] = 0;
sum += (float)x[i];
}
for (i = 0; i < 16; ++i) {
if (x[i] > 0){
printf("x[%i] = %i\n", i, x[i]);
++count;
}
}
printf("what = %.1f\n", sum/count);
}
the output being:

i = 0, x[0] = 80
sum = 0 + 80 = 80
i = 1, x[1] = 75
75%2 = 1
x[1] = 0
sum = 80 + 0 = 80
i = 2, x[2] = 72
sum = 80 + 72 = 152
i = 3, x[3] = 65
x[3] = 0
sum = 152 + 0 = 152
i = 4, x[4] = 95
x[4] = 0
sum = 152 + 0 = 152
i'm just trying hard to make sense of this program here.
so this
for (i = 0; i < 16; ++i){
if (x[i]%2 == 1)
x[i] = 0;
is going to loop each array and check if the remainder is 1. if so then the array = 0?
and then that would be added to the number in that array? (0, or that number would be added to the next number if not 0?)
sum += (float)x[i];
and is this just checking if the number is positive?
for (i = 0; i < 16; ++i) {
if (x[i] > 0){
printf("x[%i] = %i\n", i, x[i]);
++count;
}
sorry, quite new to arrays so i'm trying hard to make sense of this. some explanation or guidance would be most appreciated.