首页 > 其他 > 详细

打印100~200 之间的素数

时间:2015-11-02 06:54:27      阅读:167      评论:0      收藏:0      [点我收藏+]

#include <stdio.h>
#include <math.h>
int main()
{
 int i,j,k;
 for(i=100;i<=200;i++)
 {
  k=sqrt(i);
 for(j=2;j<=k;j++)
  if(i%j==0)break;
  if(j>k)printf("%d\n",i);
 }

 return 0;
}


打印100~200 之间的素数

原文:http://zhaoguanwen.blog.51cto.com/10824932/1708609

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!