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 }
```

Computer Science & Information Technology

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.

Computer Science & Information Technology

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).

Computer Science & Information Technology

What utility attempts to trace the path that a packet takes through the network?

a. ping b. SNMP c. traceroute d. Configmaker

Computer Science & Information Technology

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

Computer Science & Information Technology