#include <stdio.h>

int main()
{
    int n, first = 0, second = 1, next;

    printf("Enter the number of terms: ");
    scanf("%d", &n);

    printf("Fibonacci Series up to %d terms: \n", n);

    for (int i = 0; i < n; i++) 
    {
        if (i <= 1) 
        {
            next = i;
        }  
        else 
        {
            next = first + second;
            first = second;
            second = next;
        }
        printf("%d ", next);
    }

    printf("\n");

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: