The solution has already been written, nevertheless I think that in this case it makes sense to analyze the author’s mistake in detail.
So, the initial condition proposed by the author looks like this.
if (i % i == 0 & i / 1 == 0)
Let's break it into pieces:
i % i == 0 This condition is always true, since the remainder of dividing any number by the same number is always 0.
i / 1 == 0 . This condition is never satisfied, since the result of dividing any number by 1 is always equal to that number, but not like 0. It could be corrected by i % 1 == 0 , but in this case the condition will always be true, because The remainder of the division by 1 is always 0.
As a result, we get either always a lie if we do not correct the second condition; either always the truth, if we change the division by taking the remainder in the second condition.
A prime number is a natural (positive integer) number that has exactly two different natural dividers - a unit and itself.
It is necessary to understand, check that the number is divided without remainder, and 1 will pass absolutely any number, not even an integer. And from the definition it follows that there are no other numbers on which it is possible to divide the number without a remainder and that is what needs to be checked.
PS: It is a pity that we have to explain this rather simple fact, instead of your math teacher, and it’s far from a fact that the teacher is to blame. And consider. that without a good knowledge of mathematics in programming, there is generally nothing to do, so restore gaps in mathematics before it is too late.