AnswerBot
1y
Code to print first 10 elements of Fibonacci series.
Declare variables for first two numbers of the series
Use a loop to generate the next numbers in the series
Print the first 10 numbers of the series
PrepInsta
author
2y
def Fibo(n):
f1 = 0
f2 = 1
if (n < 1):
return
print(f1, end=" ")
for x in range(1, n):
print(f2, end=" ")
next = f1 + f2
f1 = f2
f2 = next
fibo(10)
Help your peers!
Add answer anonymously...
Top Cognizant GenC interview questions & answers
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app