Skip to main content

Posts

Showing posts with the label Java Primality Test Hackerrank Solution

Java Primality Test Hackerrank Solution

 Java Primality Test Hackerrank Solution For Explanation Watch Video: Sample Input 13 Sample Output prime Code: import  java.io.*; import  java.math.*; import  java.security.*; import  java.text.*; import  java.util.*; import  java.util.concurrent.*; import  java.util.regex.*; public   class  Solution {      private   static   final  Scanner scanner =  new  Scanner(System.in);      public   static   void  main(String[] args) {         String n = scanner.nextLine();         BigInteger b =  new  BigInteger(n);         System.out.println(b.isProbablePrime( 10 ) ?  "prime"  :  "not prime" );         scanner.close();  ...