public class TestaLacos3 {
public static void main(String[] args) {
    for (int numero = 1; numero <= 100; numero++) {
        boolean test1 = numero % 2 == 0;
        boolean test2 = numero % 3 == 0;
        boolean test3 = numero % 5 == 0;
        if (test1 && test2 && test3) {
            System.out.println(numero);
        } else if (test2) {
            System.out.print(numero + " ");
        }
    }
}}