Question: how can I fix my code to detect if it has no multiple for example ( cant use division or multiplication operator ) : Feed
how can I fix my code to detect if it has no multiple for examplecant use division or multiplication operator:
Feed Me i:
Feed Me j:
EAX
Feed Me i:
Feed Me j:
EAX
the output i get is
Input a number:
Input a number:
EAX
how can i fix it
program multiples;
#includestdlibhhf;
static
iDataValue : int :;
iDataValue : int :;
procedure multiplesOfAnother i: int; j: int; @nodisplay; @noframe;
begin multiplesOfAnother;
Preserving registers
pushEBX;
pushECX;
pushEDX;
Initialize EAX to default return value
mov EAX;
Assign parameters to registers for manipulation
movi EBX;
movj ECX;
Determine the smaller and larger values
cmpEBX ECX;
jg LARGERISEBX; Jump if EBX ECX
If we reach here, ECX is larger or they are equal
movEBX EDX; Start with the smaller value in EDX
jmp STARTADDING;
LARGERISEBX:
xchgEBX ECX;
movEBX EDX;
STARTADDING:
addEDX EDX;
cmpEDX ECX;
je AREMULTIPLES; If they are equal, they are multiples
jl STARTADDING; If EDX is still less, keep adding
AREMULTIPLES:
mov EAX; Set EAX to to indicate they are multiples
end multiplesOfAnother;
begin multiples;
stdout.put "Input a number: ;
stdin.get iDataValue;
push iDataValue;
push iDataValue;
call multiplesOfAnother;
this function leaves the answer in EAX
cmpEAX;
je Multiple;
jmp NotMultiple;
Multiple:
stdout.putEAX ;
jmp EndProgram;
NotMultiple:
stdout.putEAX nl;
jmp EndProgram;
stdout.newln;
EndProgram:
end multiples;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
