Determining if a number is prime

后端 未结 20 1298
悲哀的现实
悲哀的现实 2020-11-30 03:05

I have perused a lot of code on this topic, but most of them produce the numbers that are prime all the way up to the input number. However, I need code which only checks w

20条回答
  •  自闭症患者
    2020-11-30 03:15

    if(number%2!=0)
          cout<<"Number is prime:"<

    The code is incredibly false. 33 divided by 2 is 16 with reminder of 1 but it's not a prime number...

提交回复
热议问题