Program to implement Fibonacci series using C Language
Fibonacci series involves addition of last two numbers to generate next number. It can be achieved using one dimensional array and loops.
#include <stdio.h>
int main()
{
int i, fibonacci[20]; // declaration of array (0-19)
fibonacci[0] = 0; // initialization of array // value assign
fibonacci[1] = 1; // initialization of array // value assign
for( i = 2; i < 20; i++ ) //4
fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1];
for( i = 0; i < 20; i++ )
printf( "Fibonacci[%d] = %d\n", i, fibonacci[i]);
}