package main
import "fmt"
func Factorial(n uint64)(result uint64) {
if (n > 0) {
result = n * Factorial(n-1)
return result
}
return 1
}
func main() {
//var i int = 15
var b int = 5
fmt.Printf("%d 的阶乘是 %d\n", b, Factorial(uint64(b)))
}
转载于:https://my.oschina.net/donngchao/blog/3051211