Program to find Nth odd Fibonacci Number | C # program for Nth odd fibonacci number ; Function to find nth odd fibonacci number ; Driver Code
using System ; class GFG { static int oddFib ( int n ) { n = ( 3 * n + 1 ) / 2 ; int a = - 1 , b = 1 , c = 0 , i ; for ( i = 1 ; i <= n ; i ++ ) { c = a + b ; a = b ; b = c ; } return c ; } public static void Main ( String [ ] args ) { int n = 4 ; Console . WriteLine ( oddFib ( n ) ) ; } }