Here is the code, but be aware that your teacher may come here :P:
;ml /c test.asm
;link16 /tiny test.obj
.186
code segment
assume cs:code,ds:code
org 100h
begin:
jmp start
inArray db 5 dup(0);
enterMsg db "Enter 5 Numbers between 00 and 99.",13,10,"$"
enterNumb db 13,10,"Enter Number: $"
sayMaximum db 13,10, "Maximum number is: $"
errmsg db 13,10,"Invalid input$"
numCount dw 5
maxNum db ?
start:
mov dx,offset enterMsg
mov ah,09h
int 21h
inpStart:
cmp numCount,0
jz inputEnd
mov dx,offset enterNumb
mov ah,09h
int 21h
dec word ptr numCount
call getNumber
jc error1
mov si, offset inArray
add si, numCount
mov byte ptr [si], al
jmp inpStart
inputEnd:
mov cx, 0
mov al, 0
mov si, offset inArray
dec si
looper:
inc si
cmp cx, 5
jae looperExit
add cx,1
cmp al, byte ptr [si]
ja looper
mov al, byte ptr [si]
jmp looper
looperExit:
mov maxNum, al
mov dx, offset sayMaximum
mov ah,09h
int 21h
xor ax, ax
mov al, maxNum
mov dx, 10
div dl
push ax
mov dl, al
add dl, 30h
mov ah, 2
int 21h
pop ax
mov dl, ah
add dl, 30h
mov ah, 2
int 21h
mov ah, 4ch
int 21h
error1:
mov dx,offset errmsg
mov ah,09h
int 21h
mov ah, 4ch
int 21h
getNumber proc near ; Accepts only 00 to 99
sub bh,bh
mov dl,10
mov ah,1
int 21h
cmp al,"0"
jb g_error
cmp al,"9"
ja g_error
sub al, 30h
mul dl
jc g_error
cmp al, 100
ja g_error
mov bh, al
mov ah,1
int 21h
cmp al,"0"
jb g_error
cmp al,"9"
ja g_error
sub al, 30h
add al, bh
clc
ret
g_error:
stc
ret
getNumber endp
code ends
end begin
Enter 5 Numbers between 00 and 99.
Enter Number: 21
Enter Number: 66
Enter Number: 43
Enter Number: 61
Enter Number: 09
Maximum number is: 66