#include <stdio.h> #include <time.h> #include <stdlib.h> #include "constants.h" int main(void) { srand(time(NULL)); int scores [NUMBERofSTUDENTS][EXAMSCORES]; int i, j; float exam1_sum; float exam1_average; float class_sum; float class_average; for(i = 0; i <= NUMBERofSTUDENTS - 1; i++) { for(j = 0; j <= EXAMSCORES - 1; j++) { scores[ i ][ j ] = (rand() % 100 + 1); class_sum += scores[ i ][ j ]; } class_average = class_sum / 800; } for(i = 0; i <= NUMBERofSTUDENTS - 1; i++){ for(j = 0; j <= EXAMSCORES - 1; j++){ printf("%d ", scores[ i ][ j ]); } printf("\n"); } for(i = 0; i <= NUMBERofSTUDENTS - 1; i++){ for(j = 0; j <= EXAMSCORES - 1; j++){ exam1_sum += scores[ i ][ j ]; } exam1_average = exam1_sum / 800; } printf("Exam 1 average: %f\n", exam1_average); printf("Class average: %f\n", class_average); return 0; }On your final loop you wrote j <= 1 instead of j <= EXAMSCORES - 1 so your class average is off by a lot.

Your other problem was you were calculating the averages 200 times in each loop, it should be placed out of the loop. (I fixed that too)

**Fixed the third problem, the first loop you missed the "- 1". They both work now.**

*EDIT:*