Sunday, January 16, 2022

Write a program that uses a loop to calculate the first seven values in the Fibonacci number sequence.

Include irvine32.inc

.386

.STACK 4096

EXITPROCESS PROTO,DWEXITCODE:DWORD

.DATA

                                                     

 num DWORD 10

val WORD 0,1

.CODE

MAIN PROC 


mov eax,num

mov eax,0

mov bx,[val]

mov cx,[val+2]

l1:

mov edx,0

add dx,bx

add dx,cx

mov bx,cx ;1

mov cx,dx ;1

inc eax

cmp eax,num

jne l1

 


exit

INVOKE EXITPROCESS,0

MAIN ENDP

END MAIN 

No comments:

Post a Comment