mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2024-11-22 20:56:02 +03:00
19 lines
230 B
Go
19 lines
230 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func Fibonacci(x int) int {
|
|
if x == 0 {
|
|
return 0
|
|
} else if x <= 2 {
|
|
return 1
|
|
} else {
|
|
return Fibonacci(x-2) + Fibonacci(x-1)
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
fib := Fibonacci
|
|
fmt.Printf("%vn", fib(50))
|
|
}
|