;-----------------------------------------------------------------------------------------------------
; Nhập vào 3 số a,b,c (<10). In ra màn hình số lớn nhất trong 3 số vừa nhập
;-----------------------------------------------------------------------------------------------------
.model small
.code
org 100h
jmp Max
a db ?
b db ?
c db ?
tb1 db 'Nhap a: $'
tb2 db 'Nhap b: $'
tb3 db 'Nhap c: $'
tb4 db 'So lon nhat la: $'
xd db 13,10,'$'
Max proc
;in tb1
mov ah,09
lea dx,tb1
int 21h
; Nhap a
mov ah,01
int 21h
sub al,30h
mov a,al
;in xuong dong
mov ah,09
lea dx,xd
int 21h
;in tb2
mov ah,09
lea dx,tb2
int 21h
; Nhap b
mov ah,01
int 21h
sub al,30h
mov b,al
;in xuong dong
mov ah,09
lea dx,xd
int 21h
;in tb3
mov ah,09
lea dx,tb3
int 21h
; Nhap b
mov ah,01
int 21h
sub al,30h
mov c,al
;in xuong dong
mov ah,09
lea dx,xd
int 21h
; tim max
;so sach a voi b
mov bl,a
cmp bl,b
jg a_lon_hon
jmp a_nho_hon
; neu a > b
a_lon_hon:
mov bl,a
cmp bl,c
jg a_la_max
jmp c_la_max
; neu a<=b
a_nho_hon:
mov dl,b
cmp bl,c
jg b_la_max
jmp c_la_max
; neu a la max, in ra a
a_la_max:
;in tb4
mov ah,09
lea dx,tb4
int 21h
mov dl,a
add dl,30h
mov ah,02
int 21h
jmp thoat
; neu b la max, in ra b
b_la_max:
;in tb4
mov ah,09
lea dx,tb4
int 21h
mov dl,b
add dl,30h
mov ah,02
int 21h
jmp thoat
; neu c la max, in ra c
c_la_max:
;in tb4
mov ah,09
lea dx,tb4
int 21h
mov dl,c
add dl,30h
mov ah,02
int 21h
jmp thoat
thoat:
; thoat
int 20h
Max endp
;------------------------------------------------------------------------------
0 nhận xét:
Đăng nhận xét