判断质数


bool
is_prime(int n) { for(int i=2;i*i<=n;i++) if(n%i===0) return 0; return 1; }
posted @ 2016-07-18 08:42  THC1024  阅读(179)  评论(0编辑  收藏  举报