Is it possible to count down by an amount other than one?

A good answer might be:

Sure. The loop control variable could be decremented by any integer amount.

Live Code!

Here is some code that illustrates changing the loop control variable by an amount other than one.

    // the user (you) enters values for count and decrement
    while ( count >= 0 )   // GREATER-than-or-equal operator
    {
      System.out.println( "count is:" + count );
      count = count - decrement;
    }
    System.out.println( "Count was " + count + " when it failed the test");

Enter the initial value for count:        Enter a decrement value :

Notice each iteration of the loop subtracts a positive value (called decrement) from the loop control variable.

QUESTION 7:

Could you do exactly the same thing by adding a negative value to the loop control variable?

Click Here after you have answered the question