Question

2. Write an assembly language program that reads in a number, n, and outputs, Fibonacci number, F Test your program on input 13. Turn in a listing of your program and the results of this test run. (Your answer should be 233.)
0 0
Add a comment Improve this question Transcribed image text
Answer #1
.MODEL SMALL
.DATA
RES DB ?
CNT DB 0AH
.CODE
START: MOV AX,@DATA
MOV DS,AX
LEA SI,RES
MOV CL,CNT ; Load the count value for CL for looping
MOV AX,00H ; Default No
MOV BX,01H ; Default No
;Fibonacci Part
L1:ADD AX,BX
DAA ; Used to Present the value in Decimal Form
MOV [SI],AX
MOV AX,BX
MOV BX,[SI]
INC SI
LOOP L1
INT 3H ; Terminate the Program

END START

test run results

Input:13

output:233

Add a comment
Know the answer?
Add Answer to:
Write an assembly language program that reads in a number, n, and outputs, Fibonacci number, F_n....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT