Your code would do some very odd things. But first, name your variables and CONSTANTS with meaning. You use the word PRIMES and yet I see nothing in the assignment about primes.
Line 8 to 14 are your for loop collecting what looks to be numbers to be checked and then a variable count is incremented.
Finally line 16 and 17 are a true mystery as why we would expect this to not crash. Very strange to use your loop variable i outside the loop.
You may want to refactor this one.