Find the previous fibonacci number | C ++ implementation of the approach ; Function to return the previous fibonacci number ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int previousFibonacci ( int n ) { double a = n / ( ( 1 + sqrt ( 5 ) ) / 2.0 ) ; return round ( a ) ; } int main ( ) { int n = 8 ; cout << ( previousFibonacci ( n ) ) ; }