You are viewing a single comment's thread. Return to all comments →
Solution in C:
int* gradingStudents(int grades_count, int* grades, int* result_count) { int *resultGrades = malloc(grades_count * sizeof(int)); (*result_count) = 0; for (int i = 0; i < grades_count; i++) { int grade = grades[i], rounding = ((grade + 5) - ((grade + 5) % 5)); if (grade >= 38 && grade < 100 && ((rounding - grade) < 3)) { resultGrades[i] = rounding; } else resultGrades[i] = grade; (*result_count)++; printf("%d\n", resultGrades[i]); } return resultGrades; }
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all comments →
Solution in C: