Answers for "fibonacci sequence formulas"

0

fibonacci sequence

// Copy pastecode here https://play.golang.org/
package main

import "fmt"

func fibo(n int) int {
	x, y := 0, 1
	for i := 0; i < n; i++ {
		x, y = y, x+y
	}
	return x
}

func main() {
	for i := 0; i < 10; i++ {
		fmt.Println("fibo of", i, "is", fibo(i))
	}
}
Posted by: Guest on July-22-2021
1

fibonacci sequence

int n ; 
double feb  = (1/Math.pow(5,0.5)) * (Math.pow((1+Math.pow(5,0.5))/2,n)) - (1/Math.pow(5,0.5))* (Math.pow((1-Math.pow(5,0.5))/2,n));
Posted by: Guest on August-01-2021
0

fibonacci sequence

// Copy pastecode here https://play.golang.org/
package main

import "fmt"

func fibo(n int) int {
	x, y := 0, 1
	for i := 0; i < n; i++ {
		x, y = y, x+y
	}
	return x
}

func main() {
	for i := 0; i < 10; i++ {
		fmt.Println("fibo of", i, "is", fibo(i))
	}
}
Posted by: Guest on July-22-2021
1

fibonacci sequence

int n ; 
double feb  = (1/Math.pow(5,0.5)) * (Math.pow((1+Math.pow(5,0.5))/2,n)) - (1/Math.pow(5,0.5))* (Math.pow((1-Math.pow(5,0.5))/2,n));
Posted by: Guest on August-01-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language