
Just a simple loop to read 'n' values, check whether they are even or odd, and compute a sum.
#include <stdio.h>
main () {
int i, n, evensum=0, oddsum=0, x;
FILE *fin = fopen ("evenodd.in", "r");
FILE *fout = fopen ("evenodd.out", "w");
fscanf (fin, "%d", &n);
for (i = 0; i < n; i++) {
fscanf (fin, "%d", &x);
if (x/2*2 == x) evensum += x;
else oddsum += x;
}
fprintf (fout, "%d %d\n", evensum, oddsum);
exit (0);
}