isPrime是个方法吧?
- public class TestZhi {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- int count =0;
- for(int i=101;i<=200;i++){
- boolean b = true;
- for(int j =2;j<i;j++){
- if(i%j ==0){
- b = false;
- break;
- }
- }
- if(b==true){
- count++;
- if(count%10==0){
- System.out.println(i);
- }
- else{
- System.out.print(i+" ");
- }
- }
- }
- System.out.println("总共质数为:"+count+"个");
- }
- }
复制代码
|