Write a c program to print Fibonacci series using for loop

Write a c program to print the Fibonacci series using for loop. This is the basic set of the program in the C programming language. This Fibonacci number series program in any language is the basic and next step to the mathematical program in any programming language.

#include <stdio.h>
int main() 
{
int i, n, t1 = 0, t2 = 1, next;
printf("Enter the number");
scanf("%d", &n);
printf("Fibonacci Series");
for (i = 1; i <= n; ++i)
{
printf("%d, ", t1);
next = t1 + t2;
t1 = t2;
t2 = next;
}
return 0;
}

 

Output

Enter the number 6

Fibonacci Series 0, 1, 1, 2, 3, 5,

What is fibonacci series and what is real life application of fibonacci series

Fibonacci numbers are a mathematical sequence established by the Italian mathematician “Fibonacci” in the 13th century that is used to generate technical indicators. By adding the preceding two numbers, a sequence of numbers starting with zero and one is formed.

Cauliflower contains a Fibonacci spiral. Pineapples and bananas are also rich in Fibonacci numbers. Bananas have three or five flat sides, while pineapple scales contain Fibonacci spirals in groups of eight, thirteen, and twenty-one. The Fibonacci sequence may be found inside the fruit of many plants.