Practice
First N Fibonacci Numbers
HARDAlgorithms
Read a positive integer N. Output the first N Fibonacci numbers, one per line.
The sequence starts: 0, 1, 1, 2, 3, 5, 8, 13, 21, …
Input: A positive integer N (1 ≤ N ≤ 15). Output: The first N Fibonacci numbers, one per line.
Example (N = 5):
0
1
1
2
3
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: First 5
Inputs: 5
Expected: 0
1
1
2
3
Test 2: First 8
Inputs: 8
Expected: 0
1
1
2
3
5
8
13
Test 3: N = 1
Inputs: 1
Expected: 0
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade