You are viewing a single comment's thread. Return to all comments →
class Prime { boolean isPrime(int n) { if(n==1 || n==0) return false; for(int i=2;i<=n/2;i++) { if(n%i==0) { return false; } } return true; } public void checkPrime(int... n) { for(int i=0;i<n.length;i++) { //System.out.println(n[i]); if(isPrime(n[i])) { System.out.print(n[i]+" "); } } System.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 →