public class primeNum {
public static void main(String[] args) {
// TODO Auto-generated method stub
int N =100;
boolean[] a=new boolean[N+1];
for(int i=2;i<=N;i++){
a[i]=true;
}
for(int i=2;i<=N;i++){
for(int j=2*i;j<=N;j+=i){
a[j]=false;
}
}
for(int i=2;i<=N;i++){
if(a[i]) System.out.println(i);
}
}
}
热个身先
时间: 2024-12-20 14:36:20