码迷,mamicode.com
首页 > 其他好文 > 详细

1到100之间的素数

时间:2014-10-16 23:03:13      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   for   sp   div   log   bs   

 1 /*
 2  * 求1到100之间的质数
 3  */
 4 public class Zy3 {
 5     public static void main(String[] args) {
 6         System.out.print("1到100之间的素数有:\n"+"\t"+1+"\n");
 7         int j=0;
 8         for(int i=2;i<100;++i){
 9             for(j=2;j<i;++j){
10                 if(i%j==0)
11                     break;
12             }
13             if(i==j){
14                 System.out.println("\t"+i);
15             }
16         }
17     }
18 }

 

1到100之间的素数

标签:style   blog   color   ar   for   sp   div   log   bs   

原文地址:http://www.cnblogs.com/Wqwwd/p/4029768.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!