Nth Even Fibonacci Number | C ++ code to find Even Fibonacci Series using normal Recursion ; Function which return nth even fibonnaci number ; calculation of Fn = 4 * ( Fn - 1 ) + Fn - 2 ; Driver Code
#include <iostream> NEW_LINE using namespace std ; long int evenFib ( int n ) { if ( n < 1 ) return n ; if ( n == 1 ) return 2 ; return ( ( 4 * evenFib ( n - 1 ) ) + evenFib ( n - 2 ) ) ; } int main ( ) { int n = 7 ; cout << evenFib ( n ) ; return 0 ; }