prime_fibonacci.cpp
//return nth element in fibonacci series
return nth element in fibonacci series
return nth element in fibonacci series
long long int nthFib(int smallest,int largest,int length){
long long int fib[length];
fib[0]=smallest;
fib[1]=largest;
for(int i=2;i<length;i++){
fib[i]=fib[i-1]+fib[i-2];
}
return fib[length-1];
}
long long int nthFib ( int smallest , int largest , int length ) { long long int fib [ length ] ; fib [ 0 ] = smallest ; fib [ 1 ] = largest ; for ( int i = 2 ; i < length ; i ++ ) { fib [ i ] = fib [ i - 1 ] + fib [ i - 2 ] ; } return fib [ length - 1 ] ; }
return nth element in fibonacci series
return nth element in fibonacci series