mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 04:46:22 +08:00
18 lines
265 B
Go
Executable File
18 lines
265 B
Go
Executable File
package main
|
|
|
|
import "fmt"
|
|
|
|
var fibs [50]int64
|
|
|
|
func main() {
|
|
fibs[0] = 1
|
|
fibs[1] = 1
|
|
|
|
for i:= 2; i < 50; i++ {
|
|
fibs[i] = fibs[i-1] + fibs[i-2]
|
|
}
|
|
|
|
for i:=0; i < 50; i++ {
|
|
fmt.Printf("The %d-th Fibonacci number is: %d\n", i, fibs[i])
|
|
}
|
|
} |