Created
August 31, 2019 08:53
-
-
Save shoukreytom/d6bde5c0f99d4b999847a496e88c2ef6 to your computer and use it in GitHub Desktop.
checks if a number given is prime number or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.Scanner; | |
public class Check { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
BigInteger n = scan.nextBigInteger(); | |
scan.close(); | |
System.out.println(n.isProbablePrime(10) ? "prime" : "not prime"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment