The Nth Fibonacci Python

PROGRAM TO PRINT Nth FIBONACCI NUMBER


import math
  
def fibo(n):
    phi = (1 + math.sqrt(5)) / 2
  
    return round(pow(phi, n) / math.sqrt(5))
      
# Driver code    
if __name__ == '__main__'
      
    n = 9 
      
    print(fibo(n))


OUTPUT
34

Comments

Popular posts from this blog

Solve the Sudoku Python

Solve the Sudoku Java

Find Duplicates Java