C# 斐波那契数列 兔子繁殖int x = 0,y = 1; for (int j = 1; j < 10; j++,y = x + y,x = y - x) Console.Write(y + " ")(int j = 1; j < 10; j++,y = x + y,x = y - x)

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/04 01:01:48
C#斐波那契数列兔子繁殖intx=0,y=1;for(intj=1;jC#斐波那契数列兔子繁殖intx=0,y=1;for(intj=1;jConsole.Write(y+"")(intj=1;jC#

C# 斐波那契数列 兔子繁殖int x = 0,y = 1; for (int j = 1; j < 10; j++,y = x + y,x = y - x) Console.Write(y + " ")(int j = 1; j < 10; j++,y = x + y,x = y - x)
C# 斐波那契数列 兔子繁殖
int x = 0,y = 1;
for (int j = 1; j < 10; j++,y = x + y,x = y - x)
Console.Write(y + " ")
(int j = 1; j < 10; j++,y = x + y,x = y - x)

C# 斐波那契数列 兔子繁殖int x = 0,y = 1; for (int j = 1; j < 10; j++,y = x + y,x = y - x) Console.Write(y + " ")(int j = 1; j < 10; j++,y = x + y,x = y - x)
hawk1415926 ,
这是循环语句,具体的意思是,数列前两项为,0,1,这是数列初始值,J作为月下标,他要找前十个月的兔子数量,当数列下列增加一项,那么,这一项的具体值就等于前面两个之和,然后那个X等于新得的具体值减去前前面一项,就得到于新值前面的一个值,这样,计算就往后移动了一步.希望我讲明白了啊.