Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

; // -82??cenditional Jumps :Irvine\\Irvine32.inc 8 / .386 .model flat,stdcall e

ID: 3910980 • Letter: #

Question

; // -82??cenditional Jumps :IrvineIrvine32.inc 8 / .386 .model flat,stdcall e .stack 4896 13 data // write your data in this section 14 15 prompt BYTE "Enter a number", eah, edh, ? oddMsg BYTE "Odd Number", eah, edh, e 16 evenmsg EYTE "Even Numben", eah, edh, e 17 code /I write your program here 19 main proc 20 promptmove proept to edx mov edx, OFF call writestring call ReadInt 1 ;call prompt to the screen iget integer from the keyboard mov edx, mov ebx, 2 div ebx cmp edx, e jZ EVENLABEL mov eds call writestring MP EXITOUT want to divide by :2 divides ax by bx even number jump ;call oddMsg to the screen oddMsgmove oddesg to edx 32 EVENLABEL: mov eds call writestring evenisgmove evennse to edx ;call evenisg to the screern 35 EXITOUT: 36 exit 30Lnvoke Exitprocess,e 39 main main rer 82 % Cel 29 Ch 29

Explanation / Answer

Answer:

Note: User given code is modified.

Code:

include c:IrvineIrvine32.inc

ExitProcess proto, dwExitCode:dword

.data

prompt BYTE "Enter a number", 0ah, 0dh, 0

oddMsg BYTE "Odd Number", 0ah, 0dh, 0

evenMsg BYTE "Even Number", 0ah, 0dh, 0

.code

;main procedure

main proc

mov edx, OFFSET prompt

call WriteString

call ReadInt

call checkeven

cmp eax,0

jz EVENLABEL

mov edx, OFFSET oddMsg

call WriteString

jmp EXITOUT

EVENLABEL:

mov edx, OFFSET evenMsg

call WriteString

EXITOUT:

exit

invoke ExitProcess, 0

main endp

;checkeven procedure

checkeven proc

mov edx, 0

mov ebx, 2

div ebx

cmp edx,0

jz EVEN

mov eax, 0

jmp EXIT1

EVEN:

mov eax, 1

EXIT1:

ret

checkeven endp

end main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote