fibonacci-number/
This commit is contained in:
parent
c2b6b2f070
commit
a94f9af1f5
|
@ -0,0 +1,9 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
func fib(n int) int {
|
||||||
|
current, next := 0, 1
|
||||||
|
for i := 0; i < n; i++ {
|
||||||
|
current, next = next, current+next
|
||||||
|
}
|
||||||
|
return current
|
||||||
|
}
|
Loading…
Reference in New Issue