题目:
输入一个正整数 repeat(0
#include
#include
void main(void) { int repeat, i, j, m, n; int f1, f2, f3; scanf("%d", &repeat); for(i=1; i<=repeat; i++) { scanf("%d %d", &m, &n); f1 = f2 = 1; if(m == 1) { printf("%d %d ", f1, f2); } f3 = f1 + f2; while(f3 <= n) { if(f3 == 2 && m == 1) { printf("%d ", f3); f1 = f2; f2 = f3; f3 = f1 + f2; } else if(f2 >= m) { printf("%d ", f3); } f3 = f1 + f2; f1 = f2; f2 = f3; } printf("\n"); } printf("\n"); system("pause"); return 0; }
/*
------------------在VC++中显示------------------
3
1 10
1 1 2 3 5 8
20 100
21 34 55 89
1000 6000
1597 2584 4181
请按任意键继续. . .
*/