题解 | #质数因子#
质数因子
http://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
package main
import (
"fmt"
)
func main(){
value:=0
fmt.Scanf("%d",&value)
PrintFactor(value)
}
func PrintFactor(value int) {
for i:=2;i*i<=value;i++{
if (value%i)==0 {
fmt.Printf("%d ",i)
PrintFactor(value/i)
return;
}
}
fmt.Printf("%d ",value)
}