Skip to content

Commit b41a8ed

Browse files
authored
Update and rename README.md to Fibonacci
In mathematics, the Fibonacci sequence is a sequence in which each number is the sum of the two preceding ones. Numbers that are part of the Fibonacci sequence are known as Fibonacci numbers, commonly denoted Fn. The sequence commonly starts from 0 and 1.
1 parent 9516b8d commit b41a8ed

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Fibonacci

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#APPROACH-1
2+
3+
def fibonacci(n):
4+
if n<=1:
5+
return n
6+
return fibonacci(n-1)+fibonacci(n-2)
7+
a=int(input())
8+
print(fibonacci(a))
9+
10+
#APPROACH-2
11+
12+
n=int(input())
13+
n1,n2 = 0,1
14+
count = 0
15+
if n<=0:
16+
print("Enter Valid Number")
17+
elif n==1:
18+
print(n1)
19+
else:
20+
print("Fibonacci Series:")
21+
while count<n:
22+
print(n1)
23+
nth = n1+n2
24+
n1=n2
25+
n2=nth
26+
count+=1

README.md

-2
This file was deleted.

0 commit comments

Comments
 (0)