hi everyone,
this is my code that i wrote, but i couldnt do wat i want... so can someone please let me know .....
this code is to sum up all the row and column, is that possible making those two part into single statement....
i mean :
Code:
{
//sum column
//sum row
}
Code:
//sum each row
for(int row = 0; row < n; row++)
{
int sumRow = 0;
for(int col = 0; col < n; col++)
sumRow = sumRow + matrix[row][col];
cout<<"sum of row "<<row+1<<" = "<<sumRow<<endl;
}
//sum each column
for(int col = 0; col < n; col++)
{
int sumColumn = 0;
for(int row = 0; row < n; row++)
sumColumn = sumColumn + matrix[row][col];
cout<<"sum of column "<<col+1<<" = "<<sumColumn<<endl;
}