Display Fibonacci Sequence in C


In case of fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21 etc. The first two numbers of fibonacci series are 0 and 1.

Source Code

//C Program to Display Fibonacci Sequence
//0, 1, 1, 2, 3, 5
#include<stdio.h>
int main()
{
    int a=-1,b=1,c,n,i;
    printf("\nEnter The Limit : ");
    scanf("%d",&n);//4
    for(i=0;i<n;i++)
    {
        c=a+b;//0  1 1 2
        a=b;//1 0 1
        b=c;//0 1 1
        printf("\n%d",c);
    }
     return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes