adplus-dvertising
frame-decoration

Question

What does the following piece of code do?
for(int i = 0; i < row; i++)
{  
    for(int j = 0; j < column; j++)
    {
        if(i == j)
            sum = sum + (array[i][j]);
    }
}
System.out.println(sum);

a.

Normal of a matrix

b.

Trace of a matrix

c.

Square of a matrix

d.

Transpose of a matrix

Answer: (b).Trace of a matrix

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What does the following piece of code do?