C program to display Fibonacci series

Program to display fibonacci series

C program to display Fibonacci series

The Fibonacci series is a series where except for the first two terms, the next term is the summation of the previous two terms. The first two terms of the Fibonacci series are 0 followed by 1.
Here the first few numbers of the series are 0, 1, 1, 2, 3, 5, 8, ….

Now let us move to learn to display the Fibonacci series of first n numbers (entered by the user).

void main() {
    int i, num, x1 = 0, x2 = 1, nextTerm;
printf("\n\t\t\t...Welcome To EduNews.Tech... ");
    printf("\n\nEnter the number of terms: ");
    scanf("%d", &num);
    printf("Fibonacci Series: ");
    for (i = 1; i <= num; ++i) {
        printf("%d, ", x1);
        nextTerm = x1 + x2;
        x1 = x2;
        x2 = nextTerm;

    printf("\n\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");

Program Output:


I hope this post helps you to understand Fibonacci series and its implementation in C programming language.

Keep coding 🙂

1 thought on “C program to display Fibonacci series”

Leave a Reply

Your email address will not be published. Required fields are marked *