fibonacci-number/

This commit is contained in:
Gleb Koval 2022-07-06 21:05:27 +01:00
parent c2b6b2f070
commit a94f9af1f5
Signed by: cyclane
GPG Key ID: 15E168A8B332382C
1 changed files with 9 additions and 0 deletions

9
fibonacci-number/sol.go Normal file
View File

@ -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
}