Suppose that sales is a two dimensional array of 10 rows and 7 columns wherein each component is of the type int , and sum and j are int variables. Which of the following correctly finds the sum of the elements of the fifth row of sales?
A. sum = 0; for(j = 0; j < 7; j++) sum = sum + sales[5][j];
B. sum = 0; for(j = 0; j < 7; j++) sum = sum + sales[4][j];
C. sum = 0; for(j = 0; j < 10; j++) sum = sum + sales[5][j];
D. sum = 0; for(j = 0; j < 10; j++) sum = sum + sales[4][j];
Answer:B
Suppose that sales is a two dimensional array of 10 rows and 7 columns wherein each component is of the type int , and sum and j are int variables. Which of the following correctly finds the sum of the elements of the fifth row of sales?
A. sum = 0; for(j = 0; j < 7; j++) sum = sum + sales[5][j]; B. sum = 0; for(j = 0; j < 7; j++) sum = sum + sales[4][j]; C. sum = 0; for(j = 0; j < 10; j++) sum = sum + sales[5][j]; D. sum = 0; for(j = 0; j < 10; j++) sum = sum + sales[4][j];