Discussion Question
f1bsf2bsLoops
Pick one or more examples from everyday life and write a WHILE and a DO-WHILE loop.
For example, the classic "lather, rinse, repeat" on a shampoo bottle could be written as:
while (hair dirty)
{
Lather;
Rinse;
}
or as
do
{
Lather;
Rinse;
} while (hair dirty);
While my examples are very similar they are not logically equivalent. If a person has clean hair, they will not wash at all in the first example. In the second example they will lather and rinse at least once. Are your examples equivalent? (It depends on how you set it up).
- 9 years ago
- 3
Answer(1)
Purchase the answer to view it
NOT RATED
Bids(0)
other Questions(10)
- Questions
- For nyamaimule
- Finance 533 Winter, 2013 Assignment 2 Venture Capital and Private Equity
- CMGT 410 week 1 Discussion Question 3
- CMGT 410 week 4 assignment Individual, Project Controls
- Powerpoint presentation needed by 7pm EST
- Foundations of Accounting I - Accounting Project
- Briefing Paper
- religion
- ACC541 ACC/541 Accounting Standards Boards Paper