import java.util.Scanner;
class Ms
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
System.out.println("1~"+a+"的素数有:");
Ms:for(int x=3;x<=a;x++)
{
for(int y=2;y<x;y++)
{
if(x%y==0)
{
continue Ms;
}
}
System.out.println("素数:"+x);
}
}
}
|
|