public class Prime_num
{
public static void main(String args[])
{
int flg = 0;
String str = "";
for(int i=2;i<=1000;i++)
{
boolean ifss = true;
for(int j=2;j {
if(i%j==0)
{
ifss = false;
break;
}
}
if(ifss)
{
str += i+",";
flg++;
}
}
String msg = "1-1000的素数有"+flg+"个:";
System.out.println(msg+"\n"+str);
}
}