C program of Fibonacci series.

Fibonaccci Series 

  0,1,1,2,3,5,8,13,21,34,55..............

Program :

#include<stdio.h>
#include<conio.h>
void main()
{        int i,n,a=0,b=1,c;
clrscr();
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("%d,",a);
printf("%d,",b);
for(i=0;i<n-2;i++)
{
c=a+b;
printf("%d,",c);
a=b;
b=c;
}
getch();
}

Output :






Comments