Program that checks if a number is prime number

后端 未结 5 2334
情深已故
情深已故 2020-12-12 08:35

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

5条回答
  •  臣服心动
    2020-12-12 09:07

    The judgment has a problem, can only be 1 or the prime number is divisible by itself. You judge is only 2 out of the whole is not a prime number, you should use a double loop to do the conditions of judgment

提交回复
热议问题