/* Best Of The Mentors At a certain school, the best mentor of students is determined by which of the mentors has the students with the best GPAs. The purpose of this program is to first determine how many mentors there are, how many students each mentor mentors, calculate the average GPA of the students for each mentor, and determine the best of the mentors. The average GPA should be rounded to two decimal places, and the best GPA should be displayed using %.2lf. To make this problem easier, we will assume no mentor has the same average gpa for his students as another mentor (ie. no ties). SAMPLE RUN: Enter number of Mentors: 3 Enter number of students for Mentor 1: 3 Enter GPAs of the students for Mentor 1: 4 1.2 2.9 Enter number of students for Mentor 2: 4 Enter GPAs of the students for Mentor 2: 3.81 4.0 1.96 2.9 Enter number of students for Mentor 3: 4 Enter GPAs of the students for Mentor 3: 3.96 3.92 2.8 1.97 Mentor 2 is the best with an average GPA of 3.17. */ #include #include #include int main(int argc, char *argv[]) { // Declare variables int numOfMentors, numOfStudents, bestMentor, i, j; double GPA, sumOfGPAs, avgGPA, bestAvgGPA = -1; // Get the number of classes at the school printf("Enter the number of Mentors: "); scanf("%d", &numOfMentors); // Iterate through the number of mentors gathering the // GPA statistics for each of his/her students for(i=0; i bestAvgGPA) { bestMentor = i+1; bestAvgGPA = avgGPA; } } // Print the best mentor and average GPA of that mentor's students printf("\nMentor %d is the best mentor with an average GPA of %.2lf.\n", bestMentor, bestAvgGPA); return 0; }