The below code uses Binet's Algorithm to find the nth Fibonacci number.
int nthFibonacci(int n){
double phi= double(1+sqrt(5))/2;
return round(pow(phi,n)/sqrt(5));
}
The below code uses Binet's Algorithm to find the nth Fibonacci number.
int nthFibonacci(int n){
double phi= double(1+sqrt(5))/2;
return round(pow(phi,n)/sqrt(5));
}
For further actions, you may consider blocking this person and/or reporting abuse
Shawn Cao -
InfoSpark Labs -
Jelena Petkovic -
Digvijay Bhakuni -
Top comments (0)