标签:
/** * 求质数 * @param left * @param right */ static void checkPrime(int left,int right){ int count = 0; for (int i = left; i <= right; i++) { boolean flag = true; for (int j = 2; j <= Math.sqrt(i); j++) { if(flag){ if (i%j==0) { flag = false ; } } } if (flag) { count++; System.out.print(i+" "); } } }
标签:
原文地址:http://www.cnblogs.com/phyxis/p/5192924.html