A sub-program all_even() accepts a positive integer N and outputs true if all digits of N
are even, otherwise it outputs false. For example, all_even(246) outputs true and
all_even(256) outputs false.
The following algorithm is constructed for the sub-program all_even(N).
EVEN = true
loop while (N > 0) and (EVEN = true)
if (N mod 10)mod 2 = 1 then
EVEN = false
end if
end loop
output EVEN
(a) Explain why this algorithm does not obtain the correct result. [2]
(b) Outline what should be changed in the algorithm to obtain the correct result. [3]