#include<stdio.h>
void main()
{
int i,n,a[50];
printf("enter length of the series : ");
scanf("%d",&n);
a[0] = 0;
a[1] = 1;
printf("Fibonacci Series : \n");
printf("\n0\n1");
for (i = 2; i<n; i++)
{
a[i] = a[i-1]+a[i-2];
printf("\n%d\n",a[i]);
}
getch();
}
No comments:
Post a Comment