Find the error(s), if any, in each of the following:

a) ```
For ( x = 100, x >= 1, x++ )
cout << x << endl;
```
b) The following code should print whether integer value is odd or even:
```
switch ( value % 2 )
{
case 0:
cout << "Even integer" << endl;
case 1:
cout << "Odd integer" << endl;
}
```
c) The following code should output the odd integers from 19 to 1:
```
for ( x = 19; x >= 1; x += 2 )
cout << x << endl;
```
d) The following code should output the even integers from 2 to 100:
```
counter = 2;
do
{
cout << counter << endl;
counter += 2;
} While ( counter < 100 );
```


a) For should be for. The commas should be semicolons. The ++ should be a decre-
ment such as --.
b) case 0 needs a break statement.
c) += should be -=.
d) While should be while. Operator < should be <=.

Computer Science & Information Technology

You might also like to view...

The ____________________ is the height of a sound wave.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Map method entrySet returns a Set of Map.Entry objects containing the Map’s ________.

a. values b. keys c. index d. key–value pairs

Computer Science & Information Technology

To mention another user in a post, enter the ________ character, followed by the person's name

A) @ B) # C) + D) ~

Computer Science & Information Technology

When using a flowchart, input is represented by what geometric shape?

A. rectangle B. diamond C. circle D. parallelogram

Computer Science & Information Technology