Important MCQ

Output? int s = 0; for (int i = 1; i <= 3; i++) for (int j = 1; j <= 2; j++) s += i * j; cout << s;

Q.Output? int s = 0; for (int i = 1; i <= 3; i++) for (int j = 1; j <= 2; j++) s += i * j; cout << s;

A) 12
B) 18
C) 21
D) 9
Correct Answer:
Option B
Detailed Explanation:
(1+2+3) x (1+2) = 6 x 3.