1 public class Test01 { 2 3 public static void main(String[] args) { 4 int[] a = new int[101]; 5 int i,j; 6 for(i=1;i<101;i++){ 7 a[i] = i; 8 } 9 10 for(i=2;i<101;i++){ 11 if(a[i] != 0){ 12 for(j=i+i;j<101;){ 13 if(j%i == 0){ 14 a[j]=0; 15 } 16 j = j+i; 17 } 18 } 19 } 20 for(i=2;i<101;i++){ 21 if(a[i] != 0){ 22 System.out.println(i); 23 } 24 } 25 } 26 27 }