最小公倍数.asm

来自「最大公约数和最小公倍数」· 汇编 代码 · 共 77 行

ASM
77
字号
INCLUDE Irvine32.inc
.data
a byte "please input x:",0
b byte "please input y:",0
d byte "the gongbeishu is:",0
y dword ?
z dword ?
.code
main proc
mov edx,offset a
call writestring
call readint
mov z,eax
mov ebx,eax
mov edx,offset b
call writestring
call readint
mov y,eax


.if eax>ebx

cdq
div ebx
cmp edx,0
jne l1
mov edx,offset d
call writestring
mov eax,y
call writeint


.elseif eax<ebx
xchg eax,ebx

cdq
div ebx
cmp edx,0
jne l1
mov edx,offset d
call writestring
mov eax,z
call writeint

.elseif eax==ebx
mov edx,offset d
call writestring
call writeint
.endif
exit

l1:
mov eax,ebx
mov ebx,edx
cdq
div ebx
cmp edx,0
jne l1
mov edx,offset d
call writestring
mov ecx,ebx
mov eax,z
mov ebx,y
imul ebx
cdq
mov ebx,ecx
idiv ebx  
call writeint


exit
main endp
end main



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?