Sum of Fibonacci Numbers | Set 2 | C # program for the above approach ; Function to find the sum of first N + 1 fibonacci numbers ; Apply the formula ; Print the result ; Driver Code
using System ; class GFG { public static void sumFib ( int N ) { long num = ( long ) Math . Round ( Math . Pow ( ( Math . Sqrt ( 5 ) + 1 ) / 2.0 , N + 2 ) / Math . Sqrt ( 5 ) ) ; Console . WriteLine ( num - 1 ) ; } static public void Main ( ) { int N = 3 ; sumFib ( N ) ; } }