Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- #----------------------------------------------------------------------------
- # Created by : Alain Van Kerckhoven
- # Created Date: 14 janvier 2015
- # Licence : GPL
- # Version : 1.0
- # ---------------------------------------------------------------------------
- """
- Calcule le ne nombre de Fibonacci (méthode récursive)
- """
- # ---------------------------------------------------------------------------
- def fibo(n):
- if n <= 1:
- return n
- else:
- return(fibo(n-1) + fibo(n-2))
- nb = int(input("Introduisez un nombre : "))
- Fn = fibo(nb)
- print("F("+ str(nb)+") = "+str(Fn))
Advertisement
Add Comment
Please, Sign In to add comment