You are given a 6×8 (6 rows, 8 columns) array of integers , x, already initialized and three integer variables : max, i and j.

You are given  a 6×8 (6 rows, 8 columns) array  of integers , x, already  initialized  and three integer  variables : max, i and j.

LANGUAGE: C++

CHALLENGE:

You are given a 6×8 (6 rows, 8 columns) array of integers , x, already initialized and three integer variables : max, i and j.
Write the necessary code so that max will have the largest value in the array x.

SOLUTION:

max = x[0][0];
for(i = 0; i < 6; i++)
{
    for(j = 0; j < 8; j++)
    {
        if(x[i][j] > max )
	max = x[i][j];
    }
}


Add comment