#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int f1=1,f2=1;
for(int i=1;i<=20;i++)
{
cout<<" f1= "<<f1<<" f2= "<<f2<<endl;
if(i%2==0)
cout<<'\n';
f1=f1+f2;
f2=f2+f1;
}
return 0;
}
斐波那契数列(c++实现)
最新推荐文章于 2024-07-25 22:31:23 发布
