Asked inCognizant,GenC

Write code to print the first 10 elements of the Fibonacci series.

AnswerBot
2y

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
3y
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!
Select
Add answer anonymously...

Cognizant GenC interview questions & answers

A GenC was asked 1w agoQ. What is the difference between delete and truncate?
A GenC was asked 1w agoQ. What is the self keyword in Python?
A GenC was asked 1w agoQ. Explain the concepts of OOP.

Popular interview questions of GenC

A GenC was asked 2d agoQ1. How willing are you to adapt to new technologies?
A GenC was asked 1w agoQ2. What is the difference between delete and truncate?
A GenC was asked 1w agoQ3. What is the self keyword in Python?

Top HR questions asked in Cognizant GenC

A GenC was asked 5mo agoQ1. Can you tell me about yourself?
A GenC was asked 6mo agoQ2. Can you explain your project in detail?
A GenC was asked 7mo agoQ3. Tell me about your projects.
Cognizant GenC Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits