标签:
1 package everyDay; 2 3 /* 4 * 查找 101 - 200之间的素数 5 */ 6 public class FindPrimeNumber { 7 8 public static void main(String[] args) { 9 10 System.out.println("primeNumber is :"); 11 12 for (int primeNumber = 101; primeNumber <= 200; primeNumber++) { 13 int counter = 0; 14 for (int i = 2; i < primeNumber; i++) { 15 16 if ((primeNumber % i) != 0) { 17 counter++; 18 19 } else { 20 break; 21 } 22 23 } 24 if (counter == (primeNumber - 2)) { 25 System.out.println(primeNumber); 26 } 27 } 28 29 } 30 31 }
标签:
原文地址:http://www.cnblogs.com/mtlogs/p/4973796.html