write a program to generate the Fibonacci series in c language

Write a Program to Generate the Fibonacci Series in C Language


Fibonacci series program is one the popular program among learners of any programming language. In fibonacci series we have terms as :   1        1        2        3       5      8   and so on.
Program to Generate the Fibonacci Series 1

Program to Generate the Fibonacci Series



The first two terms are one, and third term is the sum of term 1 and term 2, and similarly fourth term is the sum of term 2 and term 3 and so on.


/* Program for Fibonacci Series in C Language */


#include<stdio.h>

main()

{

int n, a = 1, b = 1, c, i;

printf("Enter the number of terms\n");

scanf("%d",&n);

printf("%d\t%d\t",a,b);

for ( i = 1 ; i < n-2 ; i++ )

{

c = a + b;

printf("%d\n",c); a = b; b = c;

}

}