/* arrays in C write a program that reads 10 grades, store grades in array of integers and finds the number of passing grades, failing grades, and average in each category and total average. */ #include #define SIZE 10 //SIZE is a constant variable //predefined, has value 10 and CANNOT be change through the program int main(){ int grades[SIZE]={0},i,count_pass=0,count_fail=0,sum_pass=0,sum_fail=0; double ave_pass, ave_fail,ave_total; printf("enter %d grades\n",SIZE); for(i=0;i=60){ count_pass++; sum_pass+=grades[i]; } else{ count_fail++; sum_fail+=grades[i]; } } ave_total=(double)(sum_pass+sum_fail)/SIZE; printf("average grade is %.2f\n",ave_total); if(count_pass>0){ ave_pass=(double)(sum_pass)/SIZE; printf("%d passing grades,ave=%.2f\n",count_pass, ave_pass); } else{ printf("no passing grades\n"); } if(count_fail>0){ ave_fail=(double)(sum_fail)/SIZE; printf("%d failing grades,ave=%.2f\n",count_fail, ave_fail); } else{ printf("no failing grades\n"); } return 0; }