Ask Question
12 July, 14:22

What is the value of count after this nested FOR loop executes fully.

int count = 0;

for (int row = 4; row = < 15; row++)

for (int col = 0; col < 13; col = col + 2)

{

count+=2;

}

+2
Answers (1)
  1. 12 July, 17:51
    0
    168 (although the = < must be corrected to <=)

    Explanation:

    int count = 0;

    for (int row = 4; row < = 15; row++)

    for (int col = 0; col < 13; col = col + 2)

    count+=2;

    The inner for loop runs 7 times (for col = 0,2,4,6,8,10,12). Anything higher is not less than 13. Therefore the inner loop increments count by 2 seven times, i. e. it increments count by 14.

    The outer for loop runs 12 times (for row = 4,5,6,7,8,9,10,11,12,13,14,15).

    If the count is incremented by 14 twelve times, you are incrementing it by 14*12 = 168.

    Therefore the count goes from 0 to 168 after the nested loops.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the value of count after this nested FOR loop executes fully. int count = 0; for (int row = 4; row = < 15; row++) for (int col = 0; ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers