Golang 递归实现菲波那切数列
作者:互联网
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)
}
}
标签:return,func,fmt,那切,Golang,num,int64,Fibonacci,菲波 来源: https://blog.csdn.net/xiaobinqt/article/details/94882664