Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Please help pseudo code for this particular Fibonacci sequence?
Im trying to make a program in Visual basic that takes an initial number and a final number the initial number is where the Fibonacci sequence will begin and the final is where it will end, if someone could help me out with the logic please! pseudo code or VB Any help is appreciated thanks!
4 Answers
- Anonymous10 years agoFavorite Answer
See this logic in Matlab.
It's an almost direct-conversion to VB
http://matrixlab-examples.com/fibonacci-numbers.ht...
.
- Anonymous10 years ago
Assuming Fibonacci is 1, 1, 2, 3, 5, 8, 13, 21....
function fibonacci(int n) {
if (n <= 2) {
return 1;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
that should work I think.
- ?Lv 44 years ago
i assume you've regarded up recursion. the following is the subsequent step: a million) develop into conscious of base circumstances - returns 0 for n=0, a million for n=a million 2) develop into conscious of recursive relation - go back f(n-a million) + f(n-2) Now placed that into Java. ***** next time, do tell what you've tried already. it really is extra powerful in case you try this formerly soliciting for any help. I continually tell my scholars that I m extra difficulty about what they understand, really than what they do no longer understand!
- Don't sue me!Lv 510 years ago
declare last, curr, temp as int
last = 0
curr = start
while curr <= end
temp = curr
curr += last
last = curr
loop
the result will be stored in curr.
BTW this is pseudo code.