100以内的素数

public class test

            public static void main(String[] args)

           {  

                    int i,n,k=0;     

                    for (n = 3; n<=100; n++)

                    {        i=2;         

                            while (i<n)

                           {   if (n%i==0)  break;     i++;           }
                           if (i==n)

                          {    

                             k++;   System.out.print(i+ " ");   

                             if (k %6==0)  System.out.println();     

                          }  

                    }

         }

}

原文地址:https://www.cnblogs.com/kexiaole/p/6593912.html