class Demo {
public static void main(String[] args) {
int temp = 0;
outer: for (int i = 1; i <= 100 ; i++ ) {
inner:for (int j = 2; j < i ; j++ ) {
if ( i % j == 0) {
continue outer;
}
}
System.out.print(i+" ");
temp++;
if (temp % 5 == 0) {
System.out.println();
}
}
System.out.println();
System.out.println("素数的个数为:"+temp);
}
} |
|