The Fibonacci sequence is a collection of numbers that begins with a one or a zero, succeeded by a one, and proceeds based on the specific rule that each number is called a Fibonacci number. This number is equivalent to the sum of the preceding two numbers.
If it indicates the Fibonacci sequence F (n), where n is the first term in the sequence, the following equation gets for n = 0, where the first two terms are determined as 0 and 1 by convention:
F (0) = 0, 1, 1, 2, 3, 5, 8, 13, 21, 35……
Below is the example of C program
#include <stdio.h>
int main() {
int i, n, t1 = 0, t2 = 1, nextTerm;
printf(“Enter the number of terms: “);
scanf(“%d”, &n);
printf(“Fibonacci Series: “);
for (i = 1; i <= n; ++i) {
printf(“%d, “, t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
return 0;
}
#full stack development #php