Which of the following for loops will print the column whose subscript is 1 in o
ID: 3556739 • Letter: W
Question
Which of the following for loops will print the column whose subscript is 1 in order (i.e. from top to bottom)
for (int J = 4; J >= 0; J--)
cout << MyArray[J][1] << ' ';
for (int J = 0; J < 5; J++)
cout << MyArray[J][1] << ' ';
for (int J = 4; J >= 0; J--)
cout << MyArray[1][J] << ' ';
for (int J = 0; J < 5; J++
cout << MyArray[1][J] << ' ';
for (int J = 4; J >= 0; J--)
cout << MyArray[J][1] << ' ';
for (int J = 0; J < 5; J++)
cout << MyArray[J][1] << ' ';
for (int J = 4; J >= 0; J--)
cout << MyArray[1][J] << ' ';
for (int J = 0; J < 5; J++
cout << MyArray[1][J] << ' ';
Explanation / Answer
for (int J = 0; J < 5; J++)
cout << MyArray[J][1] << ' ';
//Here Column value is 1 and is constant .it will loop for 4 times. and values at following location are printed
//MyArray[0][1];
//MyArray[1][1];
//MyArray[2][1];
//MyArray[3][1];
//MyArray[4][1];
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.