#K73902. Fibonacci Sequence Generator
Fibonacci Sequence Generator
Fibonacci Sequence Generator
Given a non-negative integer n, your task is to generate the first n numbers of the Fibonacci sequence. The Fibonacci sequence is defined as:
\(F_0 = 0, F_1 = 1\) and \(F_i = F_{i-1} + F_{i-2}\) for \(i \ge 2\).
For example, if n equals 10, then the first 10 Fibonacci numbers are:
0 1 1 2 3 5 8 13 21 34
Make sure your program reads input from stdin
and writes the output to stdout
.
inputFormat
The input consists of a single integer n (where 1 ≤ n ≤ 90) representing the count of Fibonacci numbers to generate.
Input is read from standard input (stdin
).
outputFormat
Output the first n Fibonacci numbers in order, separated by a single space. The output should be printed to standard output (stdout
).
10
0 1 1 2 3 5 8 13 21 34