Tracing a skipped iteration

A test program adds numbered task weights but skips task 3. Complete the trace table with the value of sum after each iteration, including the skipped iteration. Enter exact integers.


C
int sum = 0;

for (int i = 1; i <= 4; i++) {
    if (i == 3) {
        continue;
    }
    sum += i;
}
Iterationsum after iteration
i = 1
i = 2
i = 3
i = 4

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: