1 Star 0 Fork 53

bjdgyc / c2go

forked from Apocalypse / c2go 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2.go 386 Bytes
一键复制 编辑 原始数据 按行查看 历史
ZenQy 提交于 2015-03-29 18:12 . last push
// 判断 101-200 之间有多少个素数,并输出所有素数。
package main
import (
"fmt"
"math"
)
func main() {
count := 0 //合数个数
for i := 101; i <= 200; i++ {
mid := int(math.Sqrt(float64(i)))
for j := 2; j <= mid; j++ {
if i%j == 0 {
//fmt.Println(i)//符合条件的即为合数
count = count + 1
break
}
}
}
fmt.Println(100 - count)
}
Go
1
https://gitee.com/bjdgyc/c2go.git
git@gitee.com:bjdgyc/c2go.git
bjdgyc
c2go
c2go
master

搜索帮助