Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is Fibonacci Series & program for it?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 164
    Comment on it

    What is Fibonacci Series ?
    Fibonacci succession arrangement or group of the numbers beginning with zero or one followed by a one, and carry on with rule that number is equivalent to the sum of prior 2 numbers.
    Fibonacci series is denoted by f(n)
    Eg:-
    If Fibonacci starts with 0 f(0)= 0, 1, 1, 2, 3, 5, 8
    If Fibonacci starts with 1 f(1)= 1, 1, 2, 3, 5, 8, 13


    Program for Fibonacci Series starts with 0 i.e. f(0).

    #include<stdio.h>
    #include<conio.h>
    void series(void);
    {
        int i, n;
    clrscr();
    // Entering the limit for Series to print 
    printf(\n Enter the limit of Fibonacci Series starting from Zero f(0):-);
    scanf(%d, n);
    series();
    getch();
    }
    void series(void)
    {
    //if Fibonacci starts with Zero i.e. f(0) keep the present value as 0
    //if Fibonacci starts with One i.e. f(1) keep the present value as 1
    
    static int past=0; present=0; next=1;
    printf(\n %d, present);
    past=present;
    present=next;
    next=past+present;
    }
    

    Output:-

    Enter the limit of Fibonacci Series starting from Zero f(0):-9
    0
    1
    1
    2
    3
    5
    8
    13
    21
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: