Fibonacci Series In C

Hello Programmers…..Now a simple program to print the Fibonacci series. Fibonacci series is a series of the numbers in which each number is the sum of two last numbers or two preceding numbers.

For example->1 1 2 3 5 8 13 ……………..

#include <stdio.h>
#include <conio.h>

main()
{
int a=1,b=1,c,i;
clrscr();

printf(“%d\n”,a);
printf(“%d\n”,b);

for (i=0;i<10;i++)
{
c=a+b;
printf(“%d\n”,c);
a=b;
b=c;
}

getch();
}

Output:

fibonacci series in c

Leave a Reply