Tux Education Our New Education Channel Please Share And Subscribe It...

/* Program To Find Out Fibonacci Series */


// Compiler : Dev-C++ 4.9.9.2

#include<stdio.h>

int main()
{
    int k,r;
    
    long int i=0l,j=1,f;
    
    //Taking Maximum Numbers From User
    printf("Range : ");
    scanf("%d",&r);
    
    printf("\n\nFibonacci Series : %ld, %ld,",i,j);//Printing First Two Values.
    
    for(k=2; k<r; k++)
    {
             f=i+j;
             i=j;
             j=f;
             printf(" %ld,",j);
    }
    
    printf("\b.");
    
    getch();
    return 0;
}

Post a Comment