Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How can I fix my code? program multiples; #include ( stdlib . hhf ) ; static Value 1 : int 3 2 :
How can I fix my code?
program multiples;
#includestdlibhhf;
static
Value : int :;
Value : int :;
procedure multiplesOfAnotheri: int; j: int; @nodisplay; @noframe;
static
returnAddress : dword;
temp: int;
begin multiplesOfAnother;
pop returnAddress ;
pop j ;
pop i ;
push returnAddress ;
initial check if the values are zero or negative
cmp j;
jl NotMultiple;
cmp i;
jl NotMultiple;
mov i ebx ;
mov j ecx ;
determine which i and j is bigger
cmp ebx, ecx ;
jg Smalleri; if i is greater than j jump to samlleri loop
jl Smallerj; if i is smaller than j jump to smallerj loop
je YesMultiples; if i is equal to j jump to equal loop
Smalleri:
mov ebx, edx ; set i to the edx register
add ebx, edx ; add i
cmp ecx, edx ; compare with j
jg NotMultiples; if j is greater than multiples of i exit with EDX
je YesMultiples; if j is equal to multiples of i exit with EDX
jmp Smalleri; otherwise keep adding
Smallerj:
mov ecx, edx ; set j to the edx register
add ecx, edx ; add j
cmp ebx, edx ; compare with i
jg NotMultiples;
je YesMultiples;
jmp Smallerj;
YesMultiples:
mov eax ;
jmp EndProcedure;
NotMultiples:
mov eax ;
jmp EndProcedure;
EndProcedure:
ret;
end multiplesOfAnother;
begin multiples;
stdout.put "Feed me i : ;
stdin.get Value;
stdout.put "Feed me j : ;
stdin.get Value;
push Value;
push Value;
call multiplesOfAnother;
Check the result
cmp eax, ;
je Yes;
jmp No;
Yes:
stdout.putEAX eax, nl;
jmp EndProgram;
No:
stdout.putEAX eax, nl;
jmp EndProgram;
EndProgram:
stdout.newln;
end multiples;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started