Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces.

LANGUAGE: JAVA

CHALLENGE:

Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces.

SOLUTION:

LANGUAGE: JAVA

CHALLENGE:

Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces.

SOLUTION:

for (int count = 1; count < 200; count++)
{
    if (count % 2 == 0)
    {
        if (count % 3 == 0)
        System.out.print(count + " ");
    }
}