首页 > 其他 > 详细

将100~200之间的素数输出

时间:2021-03-14 23:42:00      阅读:34      评论:0      收藏:0      [点我收藏+]

将100~200之间的素数输出!

素数是指一个大于1的正整数,除了1和它本身以外,不能被其他正整数整除。

 1 #include<stdio.h>
 2 #include<math.h>
 3 int main()
 4 {
 5     int i,j;
 6     for(i=101;i<=199;i++)
 7     {
 8         for(j=2;j<=sqrt(i);j++)
 9             if(i%j==0)
10                 break;            
11         if(sqrt(i)<j)
12             printf("%d\n",i);                    
13     }        
14     return 0;
15 }

 

将100~200之间的素数输出

原文:https://www.cnblogs.com/wsl8848/p/14533539.html

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