How to make an checker for prime numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make an checker for prime numbers

I know how but ineed your help to make the negative number to be not a prime number

30th Jun 2017, 9:48 AM
Charles Rivera
Charles Rivera - avatar
3 Answers
+ 9
boolean isPrime(int num) { if (num < 0) return false; // Actual Logic }
30th Jun 2017, 11:54 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 1
you mean the negative number to be recognized? well, if the number is less than zero then it is definately negative. Hope that helps
30th Jun 2017, 9:56 AM
Brian Baliach
Brian Baliach - avatar
0
can you show me how?
30th Jun 2017, 10:00 AM
Charles Rivera
Charles Rivera - avatar