package main
import "fmt"
func main() {
var s int64 = Fibonacci(7)
fmt.Println(s)
}
func Fibonacci(num int64) (int64) {
if num == 1 || num == 2 {
return 1
} else {
return Fibonacci(num-2) + Fibonacci(num-1)
}
}
Golang 递归实现菲波那切数列
最新推荐文章于 2021-09-08 20:01:03 发布