#C2545. Fibonacci Sequence Generator
Fibonacci Sequence Generator
Fibonacci Sequence Generator
Given a non-negative integer n
, generate the first n
terms of the Fibonacci sequence. The Fibonacci sequence is defined as follows:
\( F(0)=0,\ F(1)=1,\) and for \(n \ge 2,\ F(n)=F(n-1)+F(n-2) \).
Your task is to print the sequence on a single line with each term separated by a single space. If n
is zero or negative, print nothing.
inputFormat
The input consists of a single integer n
provided via standard input.
outputFormat
Output the first n
Fibonacci numbers separated by spaces on a single line to standard output.
1
0