java - Function returning a result but gives an error that it doesnt -


this question has answer here:

i try make function checks if number prime or not , eclips gives me error have return result thought do.

public static boolean isprime (int x){     for(int i=2;i<x;i++){         if(x%i==0){             return false;         }     } } 

your logic incomplete:

public static boolean isprime (int x){     for(int i=2;i<x;i++){         if(x%i==0){             return false;         }     }     return true; } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -