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.
 
 
 
 
 

756 B

fibonacci

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.

Fonction attendue

package main

func Fibonacci(int index) int {

}

Utilisation

Voici un éventuel main.go :

package main

import (
        "fmt"
        piscine ".."
)

func main() {
	arg1 := 4
	fmt.Println(piscine.Fibonacci(arg1))
}

Et son résultat :

student@ubuntu:~/piscine/test$go build
student@ubuntu:~/piscine/test$ ./test
3
student@ubuntu:~/piscine/test$