45 Star 130 Fork 53

Apocalypse / c2go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
4.go 382 Bytes
一键复制 编辑 原始数据 按行查看 历史
ZenQy 提交于 2015-03-29 18:12 . last push
// 将一个正整数分解质因数。例如:输入 90,打印出 90=2*3*3*5。
package main
import (
"fmt"
)
func main() {
var n, i int
fmt.Printf("\nPlease input a number:\n")
fmt.Scanf("%d", &n)
fmt.Printf("%d=", n)
for i = 2; i <= n; i++ {
for n != i {
if n%i == 0 {
fmt.Printf("%d*", i)
n = n / i
} else {
break
}
}
}
fmt.Printf("%d\n", n)
}
Go
1
https://gitee.com/justin.qin/c2go.git
git@gitee.com:justin.qin/c2go.git
justin.qin
c2go
c2go
master

搜索帮助