Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help adjusting this code in assembly language. The program asks user to input N, after which the program outputs the first N fibonacci numbers.

Need help adjusting this code in assembly language. The program asks user to input N, after which the program outputs the first N fibonacci numbers.

For instance if you input N = 10 then the output is: 0 1 1 2 3 5 8 13 21 34 55.

The program needs to be adjusted the order is reversed instead. So if you input N = 10 then the output would be: 55 34 21 13 8 5 3 2 1 1 0

Program:

INCLUDE Irvine32.inc INCLUDELIB Irvine32.lib

.data N DWORD ? f0 DWORD 0 f1 DWORD 1 temp DWORD ? i DWORD 2 wN BYTE "Enter N: ", 0 coma BYTE ", ", 0 .code main proc mov edx, OFFSET wN call WriteString Call ReadInt mov N, eax

mov eax, f0 call WriteInt mov edx, OFFSET coma call WriteString mov eax, f1 call WriteInt mov edx, OFFSET coma call WriteString

top : mov ebx, i cmp ebx, N ja next mov eax, f0 add eax, f1 mov temp, eax mov eax, f1 mov f0, eax mov eax, temp mov f1, eax mov eax, temp call WriteInt mov edx, OFFSET coma call WriteString inc i jmp top next : exit main endp end main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are some areas of gender-role strain for men and women today?

Answered: 1 week ago