;PROGRAM TO FIND MAXIMUM AND MINIMUM NUMBERS FROM A GIVEN UNORDERED ARRAY OF NUMBERS
data segment
list db 'ABCDEGHIJ'
count equ $-list
max db 1 dup(?)
min db 1 dup(?)
data ends
code segment
assume ds:data, cs:code
start:
mov ax,data
mov ds,ax
mov si,offset list
mov cl,count
mov al,[si]
again:
cmp al,[si+1]
jnc next
mov al,[si+1]
next:
inc si
dec cl
jnz again
mov si,offset max
mov [si],al
mov si,offset list
mov cl,count
mov al,[si]
again1:
cmp al,[si+1]
jc next1
mov al,[si+1]
next1:
inc si
dec cl
jnz again1
mov si,offset min
mov [si],al
int 3
code ends
end start
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment