All Problems
mediumLoops

Fibonacci Sequence

Problem Statement
Print the first n terms of the Fibonacci sequence.

SAMPLE INPUT

8

SAMPLE OUTPUT

0 1 1 2 3 5 8 13

CONSTRAINTS

  • 1 <= n <= 50

Explanation: Each number is the sum of the two preceding ones.

Code Editor
Output
Click "Run" to see output...