.model small
.data
arr db 9,18,27
cnt db 0
min db 50
ans db ?
.code
mov ax,@data
mov ds,ax
LEA DI,cnt
LEA SI,arr
mov cx,3
FinMin:
mov ah,BYTE PTR[SI]
cmp ah,min
jg IncSI
mov min,ah
inc SI
Loop FinMin
jmp FindHcf
IncSi:
inc SI
Loop FinMin
FindHcf:
mov ch,min
mov cnt,0
mov ax,00
Chk1:
mov ah,00
add cnt,1
cmp cnt,ch
jg ext
LEA SI,arr
mov al,BYTE PTR [SI]
div cnt
cmp ah,00
jne Chk1
Chk2:
Inc SI
mov ah,00
mov al,BYTE PTR [SI]
div cnt
cmp ah,00
jne Chk1
Chk3:
Inc SI
mov ah,00
mov al,BYTE PTR [SI]
div cnt
cmp ah,00
jne Chk1
mov ax,0000
mov al,cnt
mov ans,al
cmp cnt,ch
jle Chk1
ext:
mov ax,0
mov ah,ans
add ans,30h
mov ah,02h
mov dh,00
mov Dl,ans
int 21h
mov ax,4C00h
int 21h
end