Login or Create an Account to view the mark scheme, comment, and add to a test
Given the nested loop below and without using any kind of loop breaking function / command, state the code to include inside the selection statement such that, if and when the variable k is equal to the number 7 or the number 9, both loops will immediately stop iterating.
[2]function escape
i = 0
j = 0
k = 0
loop while i < 4
i = i + 1
k = 2 * k
loop while j <= 3
j = j + 1
k = k + 1
if k = 7 or k = 9 then
// insert code here
end if
end loop
j = 0
end loop
end function
Short Answer2 MarksPremium
0 Uses0 Views0 Likes