Generation of the Fibonacci Sequence
The Fibonacci sequence is a series of numbers where each number (called a Fibonacci number) is the sum of the two preceding ones, starting from 0 and 1. The sequence begins as follows:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
Explanation
Objective :
The objective is to generate the first 𝑛n numbers of the Fibonacci sequence.
Steps
- Input: Get the number of terms 𝑛n to generate.
- Initialize: Start with the first two terms of the sequence (0 and 1).
- Iterate: Use a loop to calculate each subsequent term by summing the two preceding terms.
- Output: Print each term of the sequence.
Algorithm in Pseudo-Code
C Implementation
Output