Johnny - 9 months ago 64

C# Question

Thank you answer by mr hoinos in the section of my art merci

Answer Source

What does the for (int j = 0; j < r; j++) do? You're calculating the matrix[j, col2] * matrix[j, col3] * r times

```
int product_col2Xcol3 = 0;
int sum_totalcol2Xcol3 = 0;
//Calculations of the SUM(Product) of col2 and col3
for (int row = 0; row < r; row++)
{
product_col2Xcol3 = matrix[row, col2] * matrix[row, col3];
sum_totalcol2Xcol3 = sum_totalcol2Xcol3 + product_col2Xcol3 ;
}
// why 2* ?????? think it shouldn't be there.
Console.WriteLine("Total is :" + 2*sum_totalcol2Xcol3 );
```

or

```
int sum_totalcol2Xcol3 = 0;
for (int row = 0; row < r; row++)
{
sum_totalcol2Xcol3 += matrix[row, col2] * matrix[row, col3];
}
Console.WriteLine("Total is :" + sum_totalcol2Xcol3 );
```