A good answer might be:

See below.

Count with Integers

If the purpose of the program fragment is to loop 100 times, then a counting loop using an integer variable should be used. Here is the best fix:

int x;

for ( x = 0; x < 100; x++ )
{
  System.out.println("Crimsom and Clover");
}

(It is conventional to write a counting loop this way, even though testing for an "exact hit" with x != 100 is logically equivalent.) Here is a poor solution:

float x;

for ( x = 0.0; x < 10.0; x += 0.1 )
{
  System.out.println("Crimsom and Clover");
}

This will probably work as intended, but there is a risk it will loop 101 times.

QUESTION 18:

Say that you need 100 values, 0.0, 0.1, up to 9.9? Can an integer-controlled counting loop be used?