1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课内】7.数组1/7-1 fibonacci数列.c

20 lines
283 B
C

#include <stdio.h>
int f[20] = {0, 1};
int main() {
for (int i = 2; i < 20; i++) {
f[i] = f[i - 1] + f[i - 2];
}
for (int i = 1; i <= 12; i++) {
printf("%6d", f[i]);
if (i % 3 == 0) {
printf("\n");
}
}
return 0;
}