Time | C ++ program to find Nth Fibonacci number using recursion ; Function to find Nth Fibonacci term ; Base Case ; Recursively computing the term using recurrence relation ; Driver Code ; Function Call
#include <iostream> NEW_LINE using namespace std ; int Fibonacci ( int N ) { if ( N < 2 ) return N ; return Fibonacci ( N - 1 ) + Fibonacci ( N - 2 ) ; } int main ( ) { int N = 5 ; cout << Fibonacci ( N ) ; return 0 ; }