#include <stdio.h> #include <math.h> int main(int argc, char* argv[]){ int i,sum,digit, n,avg; FILE *fin; sum = 0; fin = fopen("testdata29", "r"); for(i = 0; (i<=sum); i++){ fscanf(fin, "%d", &n); digit += n; n++; avg = avg +(digit/ sum); printf("The average is %d.\n", avg); } fclose(fin); return 0; }

ps. I have tried looking up how to find the average but all i come up with is the basic way to average out numbers not in a way that pertains to my coding.

Errors:

Float point exception and I'm not sure what that means exactly.

This post has been edited by **C-Boo**: 11 October 2011 - 03:02 PM