#include <stdio.h>
#include <stdlib.h>
int main() {
int n = 2;
int *a = malloc(n * sizeof *a);
a[0] = 1;
a[1] = 1;
while (n < 16) {
int old = n;
n *= 2;
int *tmp = realloc(a, n * sizeof *a);
if (!tmp) break;
a = tmp;
for (int i = old; i < n; i++) {
a[i] = a[i-1] + a[i-2];
printf("%d ",*(a+i));
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: