Created
June 4, 2021 03:41
-
-
Save sameerg07/1ef0eda3fe9875b0a01e46809d4bc62a to your computer and use it in GitHub Desktop.
fibonacci series generation for N numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(n): | |
if n == 1 or n == 2: | |
return n-1 | |
else: | |
return fibonacci(n-1) + fibonacci(n-2) | |
n = int(input()) | |
i = 1 | |
while i <= n: | |
print(fibonacci(i)) | |
i+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment