int a = 0; int b = 0; while (a < 10 & b < 10) { if ((a % 3) == 0 || (a % 3) == 0 ) continue; System.out.println(a + b); a++; b++; }