斐波那契数列(c++实现)

来源:互联网 发布:3g网络不能上网 编辑:程序博客网 时间:2024/05/17 04:57
#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;}

0 0
原创粉丝点击