diff --git a/Codes/Code-A1.py b/Codes/Code-A1.py new file mode 100755 index 0000000..1b0d923 --- /dev/null +++ b/Codes/Code-A1.py @@ -0,0 +1,17 @@ +# Problem Statement: Write a program non-recursive and recursive program to calculate Fibonacci numbers and analyze their time and space complexity. + +# Non-recursion +def fibonacci(n): + fib_series = [] + a = 0 + b = 1 + + for i in range(n): + fib_series.append(a) + a = b + b = a + b + + return fib_series + +n = int(input("Enter total numbers to print in fibonacci series:\t")) +print(fibonacci(n)) diff --git a/README.md b/README.md index d9e2085..a64ee65 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ This repository contains valuable resources for the Design and Analysis of Algor ### Codes +1. [Code-A1 - Fibonacci Series](Codes/Code-A1.py) + ### Practical ### Question Papers