
Preliminaries
4
false
while (!done)
output (product)
Start
1
2
End
true
bool done;
product=1;
int num, product, power;
input (done);
input (num);
product=product*num;
input (done);
1
3
Fig. 1.18 Flow graph of Program P1.3. Numbers 1 through 4 indicate the four basic
blocks in Program P1.3.
4, End) is the path traversed when done is true the first time the
loop condition is checked. If there is only one value of num to be
processed, then the path followed is (Start,1,2,3,2,4,End). When
there are two input integers to be multiplied then the path traversed
is (Start,1,2,3,2,3,2,4,End).
Notice that the length of the path traversed increases with the
number of times the loop ...