Find the error(s) below:
Assume that the variable counter is declared and initialized to 1. The loop should sum the numbers from 1 to 100.
```
1 while ( counter <= 100 )
2 {
3 total += counter;
4 }
5
6 counter++;
```
The increment of the counter occurs outside the loop, which causes an infinite loop because the loop-continuation condition never becomes false. Move line 6 before line 4 in the original code. The correct code is:
```
1 while ( counter <= 100 )
2 {
3 total += counter;
4 counter++;
5 }
```
You might also like to view...
The designation E0 indicates
a. Ethernet port 0. b. Ethernet input. c. External port 0. d. Exit port 0.
You can use high-capacity memory cards and higher _________________________ counts to take more images at a much higher resolution.
Fill in the blank(s) with the appropriate word(s).
What utility attempts to trace the path that a packet takes through the network?
a. ping b. SNMP c. traceroute d. Configmaker
Once a repetition statement is chosen, the other ____ elements of a loop are generally controlled by a single loop-control variable.
A. two B. three C. four D. five