Coding Global Background
Coding Global

Help me, I couldn't find why the matrix is taking more than 9 values in SL[][]...

Archived a year ago
2 messages
0 members
Created 2 years ago
Updated 2 years ago
Open in Discord
A
Анатолив.
#include <stdio.h>

int a, SL[2][2];
a = 2;




int assign_value()
{
    int i,j,etu_max, mod;
    int max = 0;
    int b_mod = 0;
    for(i=0;i<a;i++)
     {
         for(j=0;j<2;j++)
         {
            scanf("%d", &SL[i][j]);
            if(SL[i][j] > max)
            {
                max = SL[i][j];
                etu_max = i;
                mod = j;
            }
            if(SL[i][j] > b_mod)
             j = b_mod;
         }
     }
    
    printf("Best student %d with the best grade %d in %d", etu_max, max, mod);
};

int main()
{
    assign_value();
    
}

// Matrice M[etudiant][module] that contains Section A's results.
// Best student?
// Subjects with the best ranking?

Was trying to make a matrix that contain students, subjects and students marks in subjects + printing the best mark of a student + printing the best subject from the marks, but the program isn't working and I couldn't figuer it out.

Replies (2)