0% found this document useful (0 votes)
6 views2 pages

Prac 13

The document contains assembly code for a program that determines if a number is even or odd. It uses a data segment to store numbers and messages, and a code segment to perform the calculations and display the results. The program processes an array of hexadecimal numbers and outputs whether each number is even or odd.

Uploaded by

arqamqazi549
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Prac 13

The document contains assembly code for a program that determines if a number is even or odd. It uses a data segment to store numbers and messages, and a code segment to perform the calculations and display the results. The program processes an array of hexadecimal numbers and outputs whether each number is even or odd.

Uploaded by

arqamqazi549
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ALP for even odd numbers

Program:-
assume cs:code assume cs:code
assume ds:data assume ds:data
data segment data segment
a db 24h arr db 2h,3h,4h,17h,20h
msg1 db "Number is even $" e1 db ?
msg2 db "Number is odd $" o1 db ?
data ends ends data
code segment code segment
start:mov ax,data start: mov ax,data
mov ds,ax mov ds,ax
mov ax,0000h mov ax,0000h
mov al,a lea si,arr
mov bl,02h mov bl,02h
div bl mov cl,05h
cmp ah,0h up:mov al,[si]
je e1 div bl
lea dx,msg2 cmp ah,0h
mov ah,09 je eve
int 21h odd1:inc dh
jmp exit inc si
e1: lea dx,msg1 loop up
mov ah,09 jmp exit
int 21h eve:inc dl
exit: mov ah,4ch inc si
int 21h loop up
code ends jmp exit
end start exit:mov e1,dl
mov o1,dh
int 3
code ends
end start
Output:-

You might also like