Fibonacci sequence -a) Write a script to make a to sequence vector by using for loop. b) Calculate sum of first ten Fibonacci numbers
2 ビュー (過去 30 日間)
古いコメントを表示
What is Fibonacci sequence a) Write a script to make a to sequence vector by using for loop. b) Calculate sum of first ten Fibonacci numbers
回答 (1 件)
Spaceman
2024 年 3 月 21 日
編集済み: Spaceman
2024 年 4 月 8 日
In mathematics, the Fibonacci sequence is a sequence in which each number is the sum of the two preceding ones.
fib=[0 1];
for n=3:10;
fib(n)=fib(n-1)+fib(n-2);
end
fprintf('The first 10 Fibonacci sequence numbers are: ')
disp(fib)
Hope this helps, 8 years later...
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!