this is c++ code to print the sum of rows and column.
// Printing of the sum of each row.
cout<<"Printing of the sum of rows "<
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
{
r = r + num[i][j];
}
cout<<"The sum of row "<
r = 0;
}
// Printing of the sum of each column.
cout<<"Printing of the sum of columns "<
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
{
c = c + num[j][i];
}
cout<<"The sum of column "<
c = 0;
}
WHAT I DON'T UNDERSTAND IS that the codes for adding up both the rows and colum is almost same then how is the answer coming different.
there is differnece of 2 lines-->1) r = r + num[i][j];
2) c = c + num[j][i];
but thier meaning is also same- both locating to the same number, THEN HOW IS THE ANSWER COMING DIFFERNET
plzzzz help, and plz give the explaination in detail
2007-01-05
23:10:01
·
3 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design