编写M函数文件求小于任意自然数n的Fibonacci数列各项

学习 时间:2026-04-03 09:53:51 阅读:7802
编写M函数文件求小于任意自然数n的Fibonacci数列各项

最佳回答

雪白的大米

俊秀的书包

2026-04-03 09:53:51

%编成M函数文件运行后,在命令窗口输入要知道的自然数n,即可求得对应项的Fibonacci数列%有哪步有疑问请问user_entry=input('Please enter the number you want to know of the Fibonacci:');if user_entry==1||user_entry==2Result=1elsea=1;b=1;for i=3:user_entryResult=a+b;a=b;b=Result;endResult=Resultend

最新回答共有2条回答

  • 自由的往事
    回复
    2026-04-03 09:53:51

    %编成M函数文件运行后,在命令窗口输入要知道的自然数n,即可求得对应项的Fibonacci数列%有哪步有疑问请问user_entry=input('Please enter the number you want to know of the Fibonacci:');if user_entry==1||user_entry==2Result=1elsea=1;b=1;for i=3:user_entryResult=a+b;a=b;b=Result;endResult=Resultend

上一篇 生命的最后时刻的问题豆大的汗珠从总理的额上滚落下来这句话的含义是什么可以的话,也说下中心句中心句比较随便,要回答不回答都

下一篇 自己作一首描写夏天的诗词