Ohhhh, non-prime numbers also would have that factor.
Have a for loop that starts at 3
public static boolean isPrime(int num)
{
if (num <=1)
return false;
Type: Posts; User: javapenguin
Ohhhh, non-prime numbers also would have that factor.
Have a for loop that starts at 3
public static boolean isPrime(int num)
{
if (num <=1)
return false;
if(num%1==0 && num%num==0)
num%1 means the remainder of num/1 which is 0.
num/num = 1 with remainder 0.
Always true unless perhaps num = 0;