Validating while loop Man2man cam online

validating while loop-85

At the same time, we'll look at examples of programming with each control structure and apply the techniques for designing algorithms that were introduced in the previous section. There are a few points that might need some clarification.

What happens if the condition is false in the first place, before the body of the loop is executed even once?

Let's look at a typical problem that can be solved using a loop: finding the average of a set of positive integers entered by the user.

The average is the sum of the integers, divided by the number of integers.

be either simple statements or compound statements.