C program : How to find FIBONACCI series



#include<stdio.h>
int main(){
    int k,r;
    longint i=0l,j=1,f;
    //Taking maximum numbers form user
    printf("Enter the number range:");
    scanf("%d",&r);
    printf("FIBONACCI SERIES: ");
    printf("%ld %ld",i,j); //printing first two values.
    for(k=2;k<r;k++){
         f=i+j;
         i=j;
         j=f;
         printf(" %ld",j);
    }
  
    return 0;
}

Output:

C programs, C programming examples, C prorgam for fibonacci series

30 Aug 2015
Next
This is the most recent post.
Previous
C program to find Factorial of a number

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Top