码迷,mamicode.com
首页 > 编程语言 > 详细

【算法】计算质数

时间:2019-07-12 12:39:29      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:OLE   his   turn   shu   ret   for   ++   boolean   bool   

    static boolean zhishu(int a) {
        int b=a/2;
        int i=2;
        for(;i<=b;i++) {
            if(a%i==0) 
                return false;
            b=a/i;
        }
        return true;
    }

 

【算法】计算质数

标签:OLE   his   turn   shu   ret   for   ++   boolean   bool   

原文地址:https://www.cnblogs.com/LPworld/p/11175362.html

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