Nested loops with two control transfers

A test scheduler skips job 2 in every run and stops each run at a changing job number. After this C code finishes, what is the value of processed? Enter an exact integer count of jobs.


C
int processed = 0;

for (int run = 1; run <= 4; run++) {
    for (int job = 1; job <= 6; job++) {
        if (job == 2) {
            continue;
        }
        if (job == run + 2) {
            break;
        }
        processed++;
    }
}

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Data and Control Structures in C Questions: