You are viewing a single comment's thread. Return to all comments →
import static java.lang.System.*;
class Prime {
public void checkPrime(int... p){ boolean prime; for(int i=0;i<p.length;i++){ prime = true; int n = (int)java.lang.Math.sqrt(p[i]); if(p[i]>1) for(int j=2;j<n+1;j++){ if(p[i]%j==0){ prime = false; break; } } else prime = false; if(prime) { out.print(p[i]); out.print(" "); } } out.println(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Prime Checker
You are viewing a single comment's thread. Return to all comments →
import static java.lang.System.*;
class Prime {
}