Assume that the intCounter variable is declared as an int for both a and b. Identify and correct the error(s) in each of the following:

a) This statement should display in a ListBox all numbers from 100 to 1 in decreasing order.
```
for ( intCounter = 100; intCounter >= 1 )
{
lstDisplay.Items.Add( intCounter );
}
```
b) The following code should display in a ListBox the odd ints from 19 to 1 in decreas-ing order.
```
for ( intCounter = 19; intCounter >= 1; intCounter-- )
{
lstDisplay.Items.Add( intCounter );
}
```


a) The code needs intCounter-- at the end of the for header.
b) intCounter-- should be intCounter -= 2. The complete incorrect code reads:

Computer Science & Information Technology

You might also like to view...

When using a HashSet

A) you should override the hashCode method defined in the Object class B) you should override the equals method defined in the Object class C) you should override the hashCode and equals methods defined in the Object class D) you should override the hashCode, equals, and clone methods defined in the Object class

Computer Science & Information Technology

SWF files can be viewed by anyone with Flash Player installed on his or her computer.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

By far the most common task dependency is the one marked ____ in the accompanying figure.

A. 1 B. 2 C. 3 D. 4

Computer Science & Information Technology

If you want to ____, or upload, your Web pages or Web site, you will need access to a Web server.

a. serve b. post c. hang d. display

Computer Science & Information Technology