Nov 3, 2017 at 3:47am
hello, i understand your problem and the answer is simple but can be confusing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
int largestColumn = 0;
for (int i = 0; i<4; i++)
{
int sum = 0;
for (int j = 0; j<3; j++)
{
sum += a[j][i]; ///reverse i and j to count column wise
}
if (sum > largestColumn)
{
largestColumn = sum;
}
}
cout << "largest column: " << largestColumn << '\n';
}
|
Last edited on Nov 3, 2017 at 3:48am