You are viewing a single comment's thread. Return to all comments →
import java.lang.System.in; class Prime { public void checkPrime(int... num){ int count = 0; for (int n : num){ if(n == 2){ System.out.print(n + " "); } if (n > 2){ for(int i=2;i <= Math.sqrt(n);i++){ if(n%i == 0){ count++; } } if(count==0){ System.out.print(n + " "); } count = 0; } } 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 →