#include <stdio.h>

int fibonacci(int a){
    if (a <= 0) return 0;

    int vetor[a];
    vetor[0] = 0;
    if (a > 1) vetor[1] = 1;

    for(int i = 2; i < a; i++){
        vetor[i] = vetor[i-1] + vetor[i-2];
    }

    for(int b = 0; b < a-1; b++){
        printf("%d, ", vetor[b]);
    }
    printf("%d.\n", vetor[a-1]);

    return 0;
}

int main() {
    int a;
    printf("Quantos numeros deve ter a sequencia?\n");
    scanf("%d", &a);
    fibonacci(a);
    return 0;
}

Embed on website

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