Ideas:
1 through all the numbers between 100 and 300
2. Locate not divisible by 3 5 can not divisible, i.e. 3 modulo this number is not equal to 0, is not equal to 0 modulo 5
Code:
public class Demo1 {
public static void main(String[] args) {
for (int i = 100; i < 300; i++) {
if ((i % 3 != 0) && (i % 5 != 0)) {
System.out.println(i);
}
}
}
}
operation result: