斐波那契数列

来源:互联网 发布:北外英语专业教材知乎 编辑:程序博客网 时间:2024/04/29 01:04

#include <iostream>

using namespace std;

int main()

{

int a=1,b=1;

cout << a << " " ;

while (b<100&&a<100)

{

a=a+b;

cout << b << " ";

 

cout << a << " " ;

 

b=b+a;

}

 

return 0;

}

原创粉丝点击