1.)
package lee;
public class Sushu {
public static void main(String[] args) {
for(int i=2;i<=100;i++){
boolean f=true;
for(int j=2;j<i;j++){
if(i%j==0){
f=false;
break;
}
}
if(f){
System.out.print(i+",");
}
}
}
}
2.)
package lee;
public class Test1 {
public static void main(String[] args) {
for (int i = 2; i <= 100; i++) {
int j;
for (j = 2; j <= Math.sqrt(i); j++) {
if (i % j == 0)
break;
}
if (j > Math.sqrt(i))
System.out.print(i+",");
}
}
}
3.)
package lee;
public class Test2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=2;i<=100;i++){
int j;
for(j=2;j<=i/2;j++){
if(i%j==0){
break;
}
}
if(j>i/2){
System.out.print(i+",");
}
}
}
}