Solved

Which Set of Statements Totals the Items in Each Row

Question 1

Multiple Choice

Which set of statements totals the items in each row of two-dimensional array items,and displays each total


A)
int total = 0;

for (int row = 0; row < items.Length; ++row)
{
total = 0;

for (int column = 0; column < a[row].Length; ++column)
{
total += a[row][column];
}
}
B)
int total = 0;

for (int row = 0; row < items. Length; ++row)
{
for (int column = 0; column < a[row]. Length; ++column)
{
total += a[row][column];
}
}
C)
int total = 0;

for (int row = 0; row < items. Length; ++row)
{
for (int column = 0; column < a[column].length; ++column)
{
total += a[row][column];
}
}
D)
int total = 0;

for (int row = 0; row < items. Length; ++row)
{
total = 0;

for (int column = 0; column < a[column].length; ++column)
{
total += a[row][column];
}
}

Correct Answer:

verifed

Verified

Related Questions