#K41987. Print Fibonacci Sequence
Print Fibonacci Sequence
Print Fibonacci Sequence
Given a positive integer n, print the first n numbers of the Fibonacci sequence, each on a new line. The Fibonacci sequence is defined as:
$$F_0 = 0, \quad F_1 = 1, \quad F_n = F_{n-1} + F_{n-2}\,\text{ for } n \ge 2. $$If n is less than or equal to 0, output nothing. This problem tests your ability to handle simple loops and conditionals as well as manage input and output via standard streams.
inputFormat
The input consists of a single integer n provided via standard input.
Example:
5
outputFormat
Output the first n Fibonacci numbers, each on a separate line. If n is less than or equal to 0, output nothing.
Example for input 5
:
0 1 1 2 3## sample
5
0
1
1
2
3
</p>