Following is simple program to print first n Fibonacci numbers.
Input : n = 3 Output : 1 1 2 Input : n = 7 Output : 1 1 2 3 5 8 13
1 1 2 3 5 8 13
Time Complexity : O(n)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geekforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print first n Fibonacci Numbers using direct formula
- Program to print Fibonacci Triangle
- C Program to print Fibonacci Series without using loop
- C++ Program to print Fibonacci Series using Class template
- C Program for Fibonacci numbers
- Program for Fibonacci numbers
- C++ program to print all Even and Odd numbers from 1 to N
- Program to print first N Prime numbers
- Program to print a pattern of numbers
- Program to print non square numbers
- Program to print numbers from N to 1 in reverse order
- Python program to print odd numbers in a List
- Python program to print all odd numbers in a range
- Python program to print even numbers in a list
- Program to print numbers columns wise
- Python program to print all even numbers in a range
- Python Program to Print Numbers in an Interval
- Program to print numbers in digital form
- Program to print numbers with diamond pattern
- Program to print all the numbers divisible by 3 and 5 for a given number