Question 221
int total = 0;
for (int i = 1; i <= 6; i++)
{
if (i % 2 == 0 || i < 3)
total = total + i;
}
What value is stored in total after the loop finishes?Main Solution
Answer
Answer: C. The values added are 1 and 2 because they are less than 3, and 4 and 6 because they are even. The total is 1 + 2 + 4 + 6 = 13.
Answer: Correct: C
A
12
B
14
C
13
D
9
Answer images

