1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00
202401-programming-assignments/【实践课内】5.循环结构2/7-2 循环-奇怪的斐波那契数列.c

23 lines
328 B
C

#include <stdio.h>
int main() {
int n, f,
f_pre2 = 7, f_pre1 = 11;
scanf("%d", &n);
for (int i = 2; i <= n; i++) {
f = (f_pre1 + f_pre2) % 3;
f_pre2 = f_pre1;
f_pre1 = f;
}
if (f == 0) {
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
}