USING A PROGRAM FLOWCHART, EXPLAIN THE “WHILE...DO” INTERACTION CONSTRUCTION
Question Source: KNEC KCSE 1998 Computer Studies
The ‘while…do’ loop is a control structure designed to execute the same block of code again and again until a certain condition is fulfilled.
This loop is used if a condition has to be met before the statements within the loop are executed.
Pseudo code format
WHILE condition DO
Application areas of the ‘while…do’ loop
Most modern programming languages support do…while loop instead of while…do loop, the main difference between the two is; in the former, the statement comes before the condition and in the latter, the condition comes before the statement.
But while…do can be used in Pascal programming language to manipulate repetitive numeric data.
a := 5;
while a < 10 do
writeln('value of a: ', a);
a := a + 1;
value of a: 5
value of a: 6
value of a: 7
value of a: 8
value of a: 9
Form 1 to Form 4 kcse past papers latest
Pre-Primary 1 to Std 8 Latest KCPE Past papers
KNEC PAPERS FOR COLLEGE
100% of 'A' students Acknowledge the use of revision papers as a way of bettering their grades. You too can; your time is now!
Don't have Credit/Debit Card? Click here for more choices
Contact us anytime
Trusted by over 500 schools and colleges
The list keeps growing 'day in, day out' ... List of Schools in Kenya