Monday, June 24, 2019

fibanocci series in c language

#include <stdio.h>
#include <stdlib.h>

int main()
{
    long x, y,z;
    int i,n;
    x=0;
    y=1;

    printf("Enter the number of terms\n") ;
    scanf ("%d",&n);
    //printf("%d",y);
    for(i=1;i<n;i++)
    {
        z=x+y;
        printf("%d",z);
        x=y;
        y=z;
        printf("\n") ;
    }
    return 0;
}

No comments:

Post a Comment

python class topic video