📄 11.cpp
字号:
/*---------------------------------------例题11-------------------------------------------------------------------*/
#include <iostream>
using namespace std;
int main()
{
int month;
int n1 = 1, n2 = 1, n3;
cout <<"input the month :";
cin>>month;
for(int i = 2; i<month; i ++)//迭代法
{
n3 = n1 + n2;
n1 = n2;
n2 = n3;
}
cout<<"The total number of the rabbits is: "<<n3<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -