|
发表于 2022-4-23 12:24:05
|
显示全部楼层
#include<iostream>
using namespace std;
int main()
{
int i,g;
int arr[100];
arr[0] = 0;
arr[1] = 1;
i = 2;
g = 0;
while(g<1000)
{
arr[i] = arr[i-1]+arr[i-2];
g = arr[i];
if(g<=1000)
cout << g <<endl;
i++;
}
cout << i-1 << endl;
return 0;
} |
|