CoolInterview.com - World's Largest Collection of Interview Questions
Home| Ask Questions| About Us| Feedback| Contact Us|
 Interview Questions  
 Our Services  

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies

  • COOLINTERVIEW.COM LANGUAGES C DETAILS



    Question :
    fibbonaci series program




    Answer :
    #include <iostream>

    using namespace std;
    int main ()
    {
    int fOne = 1;
    int fTwo = 1;
    int fThree = 2;
    long fN;
    long fNN;

    cout << "How many n terms do you want in the sequence: ";
    cin >> fN;

    for ( fN = 1 ; fN >= 3 ; fN++ )
    {
    for (fNN = 1; fNN >= fN; fNN++)
    fNN = (fN - 1) + (fN - 2);
    cout << fN;


    #include<iostream.h>
    void main()
    {
    int a=-1,b=1,c,n;
    printf("enter the limit of the series: ");
    scanf("%d",&n);
    for(i=0,i<n;i++)
    {
    c=a+b;
    a=b;
    b=c;
    printf("%d ",c);
    }
    getch();
    }

     Posted by: preethi    

    Contact Author  Contact Author
    /*fibbonaci series*/
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    int a[20],i,n;
    printf("Enter the elements");
    scanf("%d",&n);
    a[0]=0;
    a[1]=1;
    for(i=2;i<=n-1;i++)
    {
    a[i]=a[i-2]+a[i-1];
    }
    printf("Output ");
    for(i=0;i<=n-1;i++)
    {
    printf("%d",a[i]);
    }
    getch();
    }

     Posted by: Suman Mukherjee    

    Contact Author  Contact Author
    #include<stdio.h>
    void main()
    {
    int x=-1,y=1,n;
    printf("enter the limit of the series: ");
    scanf("%d",&n);
    printf(" the series is....... ");
    fibon(x,y,n);
    getch();
    }

    void fibon(int a,int b,int m)
    { int c;
    if(m==0)
    return;
    c=a+b; m--;
    printf("%5d ",c);
    fibon(b,c,m);
    }


     Posted by: raghu    

    Contact Author  Contact Author
    #include<stdio.h>
    void main()
    {
    int a,b,c,x;
    a=0;b=1;c=a+b;
    printf("enter the length of Fibonacci series:");
    scanf("%d",&x);
    for(i=1;i<=x;i++)
    {
    c=a+b;
    printf("%d",c);
    a=b;b=c;
    }
    }

     Posted by: Rajiv    

    Contact Author  Contact Author
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    int a,b,c,i,n;
    a=-1;
    b=+1;
    clrscr();
    printf(" Enter the N terms to generate fibonacci series:");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    c=a+b;
    printf(" %d",c);
    a=b;
    b=c;
    }
    }


     Posted by: waheeda    

    Contact Author  Contact Author
    #include
    void main()
    {
    int a,b,c,x;
    a=0;b=1;c=a+b;
    printf("enter the length of Fibonacci series:");
    scanf("%d",&x);
    for(i=1;i<=x;i++)
    {
    c=a+b;
    printf("%d",c);
    a=b;b=c;
    }
    }


     Posted by: raji    

    Contact Author  Contact Author
    #include<stdio.h>
    void main()
    {
    int n,a=0,b=1,c=0;
    printf("Enter the number");
    scanf("%d",&n);
    printf("%d",b);
    while(c<=n)
    {
    c=a+b;
    a=b;
    b=c;
    printf("%d",c);
    }
    }


     Posted by: suhasini    

    Contact Author  Contact Author
    #include<iostream.h>
    #include<conio.h>
    void main()
    {
    int n1,n2,n3,n;
    n1=0;
    n2=1;
    cout<<"the numbers"<<n1<<n2;
    cout<<"enter n value";
    cin>>n;
    for(i=n3;i<=n;i++)
    {
    n3=n1+n2;
    n1=n2;
    n2=n3;
    }
    cout<<"the fibbinocciis"<<n3;
    }


     Posted by: sreelata    

    Contact Author  Contact Author
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int a,b,c,x;
    a=0;b=1;c=a+b;
    printf("enter the length of Fibonacci series:");
    scanf("%d",&x);
    for(i=1;i<=x;i++)
    {
    c=a+b;
    printf("%d",c);
    a=b;b=c;
    }
    }

     Posted by: Brijraj Agarwal    

    Contact Author  Contact Author
    #include<iostream.h>
    #include<conio.h>
    void main()
    {
    clrscr();
    long int x=0,y=1;
    int n;
    cout<<"Enter the limit :";
    cin>>n; //n is for limit
    cout<<"Series is ..... ";
    cout<<x;
    for(int i=1; i<n; i++) //i is looping variable only
    {
    x=x+y;
    y=x-y;
    cout<<" "<<x;
    }
    getch();
    }

     Posted by: Sunil Datt Sharma    

    Contact Author  Contact Author
    #include<stdio.h>
    void main()
    {
    int n,i;
    printf("Enter the n value");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    printf(" %d",fib(i));
    }
    }
    int fib(int m)
    {
    if(m==0)
    {
    return(0);
    }
    else
    {
    if(m==1)
    {
    return(1);
    }
    else
    {
    return(fib(m-1)+fib(m-2));
    }
    }
    }


     Posted by: gunasekar    

    Contact Author  Contact Author

    © CoolInterview.com
    Today's Special: Get Free Magazine from SAP now!

    A D V E R T I S E M E N T








    If you have the better answer, then send it to us. We will display your answer after the approval.
    Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       


    Rate the above answer. Help us to know about the answer.
    Category C Interview Questions
    Rating (5.0) By 1 users
    Added 8/18/2006
    Views 2528
    Rate it!
    Free Offers 300 Free Magazines for you. No credit card required. No Shipping Charges. Absolutely Free for 1 Year.

    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL C Interview Questions


    Sponsored Links  

    Google Search

    Google

    CoolInterview.com is a part of Vyom Network.
    Copyright ©2003-2009 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Privacy Policy
    Page URL: http://www.coolinterview.com/interview/10835/Default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial

    1.02