0% found this document useful (0 votes)
1 views

Looping

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Looping

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Looping

While loop is a bounded pre-test loop. It is referred to as pre test because the info is tested before using.

Requires condition with sentinel value which indicates where algorithm must be terminated.

1. Prompt for data.


2. Accept data.
3. Test data using while loop statement.
4. Update or regenerate to test again (to see if to will go again)
Starts with ‘while’, then condition, then carry out all statements associated with while loop. The staff is concerned
about the way in which to manipulate the AC settings during hot or cold time. They have reached out to you for a
system that can fix this issue. You are required to come up with an algorithm that will get the daily temperature for
a period of time. Compute the average temperature for the period and advise the office on what steps to take to cool
themselves off. If it is hot then tell them to turn down the setting on the AC or turn it up otherwise.

You might also like