You can describe all numbers that can be divided by 3 with x = 3 * n, n being an integer. This value can only be divided by 2, if n is a multiple of 2, i.e. x = 3 * (2 * m), with m = n / 2. So if n is odd, x will be an integer that can be divided by 3, but can not be divided by 2.
Examples:
n = -1: x = 3*n = -3 < 1
n = 1: x = 3*n = 3
n = 3: x = 3*n = 9
n = 5: x = 3*n = 15
...
n = 33: x = 3*n = 99
n = 35: x = 3*n = 105 > 100
So you need to start the loop with n=1 and increase n by two after each time executing the loop
1 2 3
for(n=1;n<=33;n+=2) {
//calculate x = 3*n
}
Edit: Of course you could alternatively run the loop from 1 to 100 and check each time if i can be divided by 2 and 3 using the modulo operator:
1 2 3 4 5 6
if(i%3==0) {
//i can be divided by 3
if(i%2!=0) {
//i can not be divided by 2
}
}