Sum of Fibonacci Numbers | Set 2 | Function to find the sum of first N + 1 fibonacci numbers ; Apply the formula ; Print the result ; Driver Code
function sumFib ( N ) { var num = Math . round ( Math . pow ( ( Math . sqrt ( 5 ) + 1 ) / 2.0 , N + 2 ) / Math . sqrt ( 5 ) ) ; document . write ( num - 1 ) ; } var N = 3 ; sumFib ( N ) ;