Skip to content

Commit 8c888e9

Browse files
committed
Zoho
1 parent c2389b5 commit 8c888e9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

isFibNumber.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'''print only those number which is present in fibonacci series'''
2+
def fib(n):
3+
lis = [0]
4+
a = 0
5+
b = 1
6+
while n > 0:
7+
c = a+b
8+
a = b
9+
b = c
10+
n -= 1
11+
lis.append(a)
12+
return lis
13+
def isFib(arr):
14+
lis = fib(max(arr))
15+
for i in arr:
16+
if i in lis:
17+
print i,
18+
19+
isFib([2,10,4,8])

0 commit comments

Comments
 (0)