1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00
202401-programming-assignments/【实践课内】7.数组1/7-1 fibonacci数列.c

20 lines
283 B
C
Raw Normal View History

2024-11-06 02:32:30 +00:00
#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;
}