INCLUDE Irvine32.inc
.data
EnterN BYTE "Enter Number 1: ",0
EnterK BYTE "Enter Number 2 : ",0
Addition BYTE "Addition: ",0
Subtruction BYTE "Subtruction: ",0
OddNumber BYTE " Odd", 0
EvenNumber BYTE " Even", 0
greater BYTE "Number1 greater Number2", 0
less BYTE "Number1 less Number2", 0
equal BYTE "Number1 equal Number2", 0
n DWORD ?
k DWORD ?
.code
main PROC
mov edx, OFFSET EnterN
call WriteString
call Readint ; Reads N
mov n, eax ; save N
mov edx, OFFSET EnterK
call WriteString
call Readint ; Reads K
mov k,eax ; save K
call crlf
mov edx, OFFSET Addition
call WriteString
add eax, n
call WriteInt ; write Addition answer
call CrLF
mov edx, OFFSET Subtruction
call WriteString
mov eax, n
sub eax, k
call WriteInt ; write Subtruction answer
call crlf
call crlf
; is N Odd or Even
mov eax, n
call WriteInt
and n, 1
jz _oddN
mov edx, OFFSET EvenNumber
call WriteString
jmp _testK
_oddN:
mov edx, OFFSET OddNumber
call WriteString
; is K Odd or Even
_testK:
call crlf
mov eax, k
call WriteInt
and k, 1
jz _oddK
mov edx, OFFSET EvenNumber
call WriteString
jmp _testCmp
_oddK:
mov edx, OFFSET OddNumber
call WriteString
_testCmp:
call crlf
call crlf
mov edx, OFFSET EnterN
call WriteString
call Readint ; Reads N
mov n, eax ; save N
mov edx, OFFSET EnterK
call WriteString
call Readint ; Reads K
call crlf
sub eax, n
jz _equal
jnc _less
mov edx, OFFSET greater
call WriteString
jmp final
_equal:
mov edx, OFFSET equal
call WriteString
jmp final
_less:
mov edx, OFFSET less
call WriteString
final:
call crlf
Invoke ExitProcess,0 ; exit to operating system
main ENDP
END main
Comments
Leave a comment