What is wrong with the following while repetition structure. while( z >= 0 )
sum += z;
Solution
The value of the variable z is never changed in the while structure.
Therefore, if the loop continuation condition ( z >= 0 ) is true, an
infinite loop is created. To prevent the infinite loop, z must be decremented
so that it eventually becomes less than zerobr
If You Enjoyed This, Take 5 Seconds To Share It
0 Questions:
Post a Comment