PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Fibonacci sequence upto n
# (c) Rahul Verma
#==========================================#
n = int(input())
f = 0
s = 1
print(f)
print(s)
for i in range(0, n-2):
t = f + s
print(str(t) + " ")
f = s
s = t
if n == 1:
raise ValueError("Input should be greater than 1")
#==========================================#
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run