, 4
(d) The Fibonacci sequence is a series of numbers. It starts with the number 0 and then 1. Each
number after that is a sum of the two numbers before it.
The first seven numbers in the series are:
0
1
1 (i.e. 1 + 0)
2 (i.e. 1 + 1)
3 (i.e. 1 + 2)
5 (i.e. 2 + 3)
8 (i.e. 3 + 5)
Orla has written some code to show the first five numbers in the Fibonacci sequence (0,1,1,2,3)
using the Little Man Computer (LMC) instruction set.
The LMC code that Orla has written contains an error.
START LDA MAX
BRZ END
LDA A
OUT
ADD B
STA B
LDA B
STA A
LDA MAX
SUB ONE
STA MAX
BRA START
END HLT
A DAT 0
B DAT 1
MAX DAT 5
ONE DAT 1
(i) State the five outputs that Orla’s code would give.
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller williesmaish2999. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.89. You're not tied to anything after your purchase.