package java1;
import java.util.Scanner;
public class demo4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 0;
int j = 0;
int count = 0;
for(n = 2; n <= 1000; n++) {
for(j = 2; j <= n; j++) {
if(n % j == 0 && n != j) {
break;
}
if(n % j == 0 && n == j) {
count++;
System.out.println("第" + count + "个质数=" + n);
}
}
}
System.out.println("--------1000以内总共" + count + "个质数!-------");
}
}