Fibonacci sequence -a) Write a script to make a to sequence vector by using for loop. b) Calculate sum of first ten Fibonacci numbers
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Antworten (1)
Spaceman
am 21 Mär. 2024
Bearbeitet: Spaceman
am 8 Apr. 2024
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 Kommentare
Siehe auch
Kategorien
Mehr zu Data Types finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!