Program to find Nth odd Fibonacci Number | Function to find nth odd fibonacci number ; Driver Code
function oddFib ( n ) { n = ( 3 * n + 1 ) / 2 ; var a = - 1 , b = 1 , c , i ; for ( i = 1 ; i <= n ; i ++ ) { c = a + b ; a = b ; b = c ; } return c ; } var n = 4 ; document . write ( oddFib ( n ) ) ;