The program will print:
4 5 6 7 8 9 10 11 12 . . . . and so on forever
COUNT
starts out at 4, which is greater than 0, so the
loop body will execute.
' Modified Program ' LET COUNT = 4 'Statement 1 ' DO WHILE COUNT > 0 'Statement 2 PRINT COUNT 'Statement 3 LET COUNT = COUNT + 1 'Statement 4 LOOP END
At the end of the loop body, COUNT
is changed to 5.
The DO WHILE
will let the loop body execute again, and COUNT
is changed to 6.
COUNT
starts out above 0, and keeps getting larger each time, so the condition:
DO WHILE COUNT > 0 ^ | +--- always 4 or larger
will always be true. Actually, there is a problem.
Can you enter any number you want on an electronic calculator, no matter how large?