2007년 03월 11일
[code] 최대 공약수
INCLUDE Irvine32.inc
.data
Input byte "Insert Value: ", 0
result byte "GCD is ", 0
op1 dword ?
op2 dword ?
.code
main PROC
mov edx, offset Input
call WriteString
call ReadInt
mov op1, eax
call WriteString
call ReadInt
mov op2, eax
call GCD_Function
mov edx, offset Result
call WriteString
call WriteDec
call Crlf
exit
main ENDP
GCD_Function PROC
mov eax, op1
mov ebx, op2
GCD_Operator:
cmp eax, ebx
jl Swap
sub eax, ebx
cmp ebx, 0
je Quit
jmp GCD_Operator
Swap:
push eax
push ebx
pop eax
pop ebx
jmp GCD_Operator
Quit:
ret
GCD_Function ENDP
END main
# by | 2007/03/11 19:58 | ┣ ASM | 트랙백 | 덧글(0)





☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]