語法:
public class p11
{
public static void main(String args[])
{
int n,m,max=0;
System.out.println("小於60的質數有");
for(n=2;n<=60;n++)
for(m=2;m<=n;m++)
{
if(n%m==0 && m!=n)
break;
else if(m==n) // prime found
{
max=m;
System.out.println(m);
}
}
System.out.println("最大質數是"+max);
}
}