Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

is prime java

    public static boolean isPrime(int n) {
        for (int i = 2; i <= Math.sqrt(n); i++)
            if (n % i == 0) return false;
        return n > 1;
    }
 
PREVIOUS NEXT
Tagged: #prime #java
ADD COMMENT
Topic
Name
7+1 =