CSDN博客

img yh111

1.判素函数.

发表于2005/1/3 23:59:00  482人阅读

求100--200间的全部素数.


       #include<math.c>

         main()

           {
              int m,k,i,n=0;

               for(m=101;m<=200;m=m+2)

                {  if(n%10==0)           /*n用来实现换行*/

                  k=m/2;

                 for(i=2;i<=k;i++)

                   if(m%i==0)

                    break;

                  if(i>=k+1)

                  {

                      print("%d ",m);

                       n=n+1;

                  }

              }}

阅读全文
0 0

相关文章推荐

img
取 消
img