prime check jaba

Solutions on MaxInterview for prime check jaba by the best coders in the world

showing results for - "prime check jaba"
Lea
22 Jan 2019
1 static boolean isPrime(int n){
2        boolean result=true;
3        if(n <= 1) return false;
4        for(int i = 2; i <= n/2; i++){
5            if(n % i == 0){
6                result = false; //if some number divides it, then prime=false;
7                break;
8            }
9        }
10        return result;
11    }
queries leading to this page
prime check jabaprime check jaba