fork download
  1. #include <stdio.h>
  2. #define STUDENTS 3
  3. #define EXAMS 4
  4.  
  5. int maximum( const int grades[][EXAMS], int pupils, int tests );
  6.  
  7. int main(void)
  8. {
  9. int studentGrades[STUDENTS][EXAMS] = { {77,68,86,73},
  10. {96,87,89,78},
  11. {70,90,86,81} };
  12.  
  13. printf("maximum : %d\n", maximum( studentGrades, STUDENTS, EXAMS ) );
  14.  
  15. return 0;
  16. }
  17.  
  18. int maximum( const int grades[][EXAMS], int pupils, int tests )
  19. {
  20. int high_grade = 0;
  21.  
  22. for(int i=0; i<pupils; i++){
  23. for(int j=0; j<tests; j++){
  24. if(grades[i][j] > high_grade)
  25. high_grade = grades[i][j];
  26. }
  27. }
  28. return high_grade;
  29. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
maximum : 96