I keep getting segmentation or bus errors based on this code:

It compiles fine and the output is just like the ones in the assignment.

Thanks!Code:/* */ #include <stdio.h> int main(void) { int cases,a; scanf("%d",&cases); float student_percentage[cases]; for(a=0; a<cases; a++) { int students; scanf("%d",&students); int b,c,d; float total,average; float num_of_students = 0; float grades[students]; for(b=0; b<students; b++) { scanf("%f",&grades[b]); } total = 0; for(c=0; c<students; c++) { total = total + grades[c]; } average = total / students; for(d=0; d<students; d++) { if(grades[d] > average) { num_of_students++; } else { }; } student_percentage[a] = num_of_students / students; } int x; for(x=0; x<cases; x++) { printf("%.3f%%\n",student_percentage[x]*100); } return 0; }