Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fibonacci subject #2785

Open
Sonic972 opened this issue Oct 28, 2024 · 0 comments
Open

fibonacci subject #2785

Sonic972 opened this issue Oct 28, 2024 · 0 comments
Assignees

Comments

@Sonic972
Copy link

fibonacci

J'ai utilisé un "for" et mon code à été accepté:

package piscine

func Fibonacci(index int) int {
	if index >= 0 {
		if index == 0 {
			return 0
		}
		result := 1
		result_prec := 0
		temp := 1
		for i := 1; i < index; i++ {
			result += result_prec
			result_prec = temp
			temp = result
		}
		return result
	}
	return -1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants