Hello I have created this program to check if a number is a prime number. It works but for some reason says that 999 is a prime number. Where is my mistake. It would be grea
If a number is prime, that means no number evenly divides it besides 1 and itself. That mean you need to check every number below it before being able to say the number is prime.
In your code, you are exiting the loop on the first iteration -- regardless of how large the number is.