Header Ads Widget

Ticker

6/recent/ticker-posts

find the fibonecci series using for loop

 COMPUTER GAYN

Q. find the fibonecci series using for loop?

ANS:-

                  #include<stdio.h>

                    int main()

                  {

                       int f[5],n,i,fib;


                        printf("enter the numbers of elements:/n");

                       scanf("%d",&n);

                     f[0]=0;

                     f[1]=1;

                     for(i=2;i<=n;i++);

                        {

                            f[i]=fib(i-1)+(i-2);

                       }

                           printf("the fibonacci series is:/n");

                           for(i=0;i<=n;i++);

                           {

                         printf("%d ",fib[1]);

                           }

                        return 0;



                 }

Post a Comment

0 Comments