With a twodimensional array for which operations would you u

With a two-dimensional array, for which operations would you use nested \"for\" loops and for which operations would you use a single \"for\" loop?

When performing an operation on a given row, which index is fixed and which index is used as the looping variable?

When performing an operation on a given column, which index is fixed and which index is used as the looping variable?

Please give 2 to 3 sentence answers for each question. Can i please get these questions answered

Solution

With a two-dimensional array, for which operations would you use nested \"for\" loops and for which operations would you use a single \"for\" loop?

Answer:
   When you want to traverse each column and each row( generally while taking input and displaying output), you need to use
   nested for loop: one loop to travrse row wise and other loop to traverse column wise

   When you want to traverse a particulat row/column(one row/column), you need to use single for loop

When performing an operation on a given row, which index is fixed and which index is used as the looping variable?
Answer:
   row index is fixed and column index is used for looping

When performing an operation on a given column, which index is fixed and which index is used as the looping variable?
Answer:
   column index is fixed and row indexis used for loopind

With a two-dimensional array, for which operations would you use nested \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site