I have few bugs which i cant locate...driving me nuts...some extra calculations which are completely irrelivant.And thats happening after it reads BART SIMPSON. Also how do i get rid of END OF FILE at the end?

Code:#include <stdio.h> #include <string.h> #include <time.h> #define SENTINAL -1 int Tm (void){ time_t t; char now[20]; time(&t); strcpy (now, ctime(&t)); printf ("%s", now); return (0); } int calc (int sum, int numbers[]) { int i, j; i = 0; j = 0; while (numbers[i] != -1 && j < 10) { if (numbers[i]== 10) { sum = sum + numbers[i] + numbers[i+1] + numbers[i+2]; i = i + 1; printf("%3d ", sum); } else if (numbers [i] + numbers[i+1] == 10) { sum = sum + numbers[i] + numbers[i+1] + numbers[i+2]; i = i +2; printf("%3d ", sum); } else { sum = sum + numbers[i] + numbers[i+1]; i = i + 2; printf("%3d ", sum); } } ++j; } void print_shots (int numbers[]) { int i=0, j; j = 0; while (numbers[i]!=-1 && j < 10) { if (numbers[i]==10) { printf(" X"); ++i; } else if (numbers [i]+numbers[i+1]==10) { printf("%5d/",numbers[i]); i=i+2; } else { printf("%5d-%d",numbers[i],numbers[i+1]); i=i+2; } ++j; } } int main (void) { FILE *fp; char buff[300],end[]= "End of data"; int numbers[300],count[50],temp, sum; int i=0,j; temp = 1; Tm(); fp = fopen("c:/bowling.dat", "r"); while (temp !=0) { fgets(buff, sizeof(buff), fp); printf("\n"); i = 0; printf("%s", buff); fscanf(fp,"%d", &numbers[i]); while (numbers[i] !=SENTINAL) { printf("%4d", numbers[i]); ++i; fscanf(fp,"%d", &numbers[i]); } printf("\n"); // fgets(buff, sizeof(buff), fp); print_shots(numbers); sum = 0; printf("\n"); calc(sum, numbers); i = 0; if (buff[0] == end[0] && buff[1]==end[1] && buff[2] == end[2] && buff[3] == end[3] && buff[4] == end[4] && buff[5] == end[5] && buff[6] == end[6] && buff[7]== end[7]) { temp = 0; } fgets(buff, sizeof(buff), fp); } return(0); }