Question PSC-LOOP-0049
MediumWhat will be printed by the following pseudocode?
Integer n = 5, i, j, total = 0
for (each i from 1 to n)
for (each j from 1 to n)
if (i == j or i + j == n + 1)
total = total + 1
end if
end for
end for
Print total
- A.
8
- B.
10
- C.
Sign up free to see the answer and a step-by-step explanation.