This example will only print even values between 0 and 10:

Example

for (int i = 0; i <= 10; i = i + 2) {
  System.out.println(i);
}



Practice Excercise Practice now