29. Program to Display Fibonacci Series


Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. #include
    int main(){
    int k,r;
    long int i=0l,j=1,f;
    clrscr();

    printf("Enter the number range:");
    scanf("%d",&r);

    printf("FIBONACCI SERIES: ");
    printf("%ld %ld",i,j);
    for(k=2;k<r;k++){
    f=i+j;
    i=j;
    j=f;
    printf(" %ld",j);
    }

    getch();
    }

    ReplyDelete
  3. void main()
    {
    int t1=0,t2=1,t3,n,i;
    clrscr();
    printf("Enter number of terms");
    scanf("%d",&n);
    printf("The fibonacci series is");
    printf("%d %d",t1,t2);
    for(i=0;i<n;i++)
    {
    t3=t1+t2;
    t1=t2;
    t2=t3;
    printf("\t%d",t3);
    }
    getch();
    }

    ReplyDelete
  4. Program to Display Fibonacci Series

    #include
    #include
    void main()
    {
    int no ,no1,no2,no3,i=0,pos=4;
    clrscr();
    printf("Enter the first no:");
    scanf("%d",&no1);
    printf("Ente rthe second no:");
    scanf("%d",&no2);
    while(i<=pos)
    {
    no=no1+no2;
    printf("\n \t no=%d",no);
    no1=no2;
    no2++;
    i++;
    }
    getch();
    }

    ReplyDelete

Post a Comment