The problem is that you are leaving the <Enter> key in the keyboard after getting the number of students. After numeric input like that you have to flush the keyboard of the '\n' character.
double sum=0;
printf("How many students are in class %d?\n",(i+1));
int t=0;
scanf("%d",&t);
getchar();