EmbLogic's Blog

fibonacci series using array

1 #include
2 int main()
3 {
4 int a,b,c,i,n;
5 b=0;
6 c=1;
7 printf(“enter the value \n”);
8 scanf(“%d”,&a);
9 int d[a];
10 d[0]=0;
11 d[1]=1;
12 i=2;
13 printf(“%d”,d[0]);
14 while(i<a)
15 {
16 d[i]=b+c;b=c;c=d[i];
17 i++;
18 }for(i=0;i<a;i++)
20 printf("%d\n",d[i]);
21 }

19 for(i=0;i<a;i++)
20 printf("%d\n",d[i]);
21 }
22

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>