修正: 斐波那契
This commit is contained in:
parent
7b07eb048f
commit
f3750b2851
|
@ -13,8 +13,13 @@ int main()
|
||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 1;
|
int b = 1;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
cout << a << "\t" << b << "\t";
|
|
||||||
while (c <= n)
|
if (n >= 1)
|
||||||
|
cout << a << "\t";
|
||||||
|
if (n >= 2)
|
||||||
|
cout << b << "\t";
|
||||||
|
|
||||||
|
while (n > 2 && c <= n)
|
||||||
{
|
{
|
||||||
c = a + b;
|
c = a + b;
|
||||||
if (c <= n)
|
if (c <= n)
|
||||||
|
|
Loading…
Reference in New Issue