algorithms-go/other/斐波拉契数列/main.go

14 lines
168 B
Go
Raw Normal View History

2021-04-07 14:27:14 +08:00
package main
import "fmt"
func main() {
fmt.Println(fibonacci(36))
}
func fibonacci(i int) int {
if i < 2 {
return i
}
return fibonacci(i-2) + fibonacci(i-1)
}