You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
756 B

5 years ago
## fibonacci
5 years ago
### Intructions
Écrire une fonction **récursive** qui renvoie la valeur de la suite de fibonacci correspondant à l'index passé en paramètre.
La premiére valeur est à l'index `0`.
La suite débute ainsi: 0, 1, 1, 2, 3 etc...
Un index négatif renvoie `-1`.
`for` est **interdit** pour cet exercice.
5 years ago
### Fonction attendue
```go
package main
func Fibonacci(int index) int {
}
```
5 years ago
### Utilisation
Voici un éventuel `main.go` :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 4
fmt.Println(piscine.Fibonacci(arg1))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$go build
student@ubuntu:~/piscine/test$ ./test
3
student@ubuntu:~/piscine/test$
```