Skip to Main Content

NEW TO JAVA..............................

1043196Sep 25 2013 — edited Sep 27 2013

For each part below show a for loop that advances the loop index variable (call it i in each case) as shown. For example the loop body can just print the value of i.

  1. From 1 to 10 (inclusive)
  2. From 0 to 10 (inclusive) by steps of two. For example: 0, 2, 4, etc.
  3. From 1 to 1024 (inclusive) doubling each time. For example: 1, 2, 4, 8, 16, etc.
  4. From 10 down to 1 (inclusive).
  5. From 1.0 down to the smallest number still greater than 0.1, cutting the value in half each time. For example: 1.0, 0.5, 0.25, 0.125.
Comments
Post Details
Added on Sep 25 2013
3 comments
1,846 views