How to Print Fibonacci series in c program first you have to know what is Fibonacci series? To Print a Fibonacci series you have to clear your logic.Lets begin,

What is Fibonacci series?

First two numbers of the fibonacci series is 0 and 1. From 3rd number onwards, the series will be the sum of previous 2 numbers.

Fibonacci series : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, etc

Code :

#include <stdio.h>
int main()
{
   int f1=0, f2=1, fib_ser, count=2, lmt;

   printf("Enter the limit of the Fibonacci series :");
   scanf("%d",&lmt);
   printf("\nFibonacci series is: \n%d \n%d \n",f1,f2);

   while (count < lmt)
   {
      fib_ser=f1+f2;
      count++;
      printf("%d\n",fib_ser);
      f1=f2;
      f2=fib_ser;
   }
   return 0;
}

 

Output :

Please enter the limit of the Fibonacci series : 4
Fibonacci series is:
0
1
1
2