• Now Online : 63
  • admin@codemyne.net

Introduction

The program shows how to display fibonacci series. fibonacci series is nothing but, a digit is sum of before two digits. 0 1 1 2 3 5 8... as shown in this series a digit is addition of previous two digits.

#include<stdio.h>
#include<conio.h>
void main()
{
    int n,first=0,second=1,next,c;
    printf("/n Enter the no.of terms:");
    scanf("%d",&n);
    printf("/n First %d terms of fibonacci series are:",n);
    for(c=0;c<n;c++)
    {
        if(c<=1)
        next=c;
        else
        {
            next=first+second;
            first=second;
            second=next;
        }
        prinf("/n %d",next);
    }
                                                    return 0;
}

Comments/Suggestions are invited. Happy coding......!

Comments Post a Comment