Fibonacci Series

Easy 20 XPLoopsMath

Commonly asked at TCS, Infosys, Zoho

Read n and print the first n Fibonacci numbers on one line, separated by spaces. The series starts 0 1 1 2 3 5 …, each number being the sum of the previous two.

Input
One integer n (n ≥ 1).
Output
n numbers separated by spaces.

Sample 1

Input

7

Output

0 1 1 2 3 5 8

Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.
The solution unlocks after 3 submissions.