The following is a C Program To Print Fibonacci Series on screen after taking input from the user. Let's get started.

C Program To Print Fibonacci Series
C Program To Print Fibonacci Series

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.
for() loop is used to undergo iteration process.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
    int n,a=0,b=1,c,d;
    clrscr();
    printf("Enter the number of terms\n");
    scanf("%d",&n);
    printf("First %d terms of Fibonacci series are:\n",n);
    for(d=0;d<n;d++)
    {
      if(d<=1)
         c=d;
      else
      {
         c=a+b;
         a=b;
         b=c;
      }
      printf("%d\n",c);
    }
    getch();
}


Output

Fibonacci Sequence Output
Fibonacci Series Output

All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program To Print Fibonacci Series! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.