Fibonacci in C(easy code logic)

code:

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int first=0,second=1,N,temp;
    printf("Put value greater than 1: ");
    scanf("%d",&N);
    while(first<=N)
    {
        printf("%d\t",first);
        temp=first;
        first=second;
        second=first+temp;
    }
}

output:
0 1 1 2 3 5 8 13

http://www.codewithc.com/c-program-for-fibonacci-series/

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.