assume cs:codesg,ds:data
data segment
number db 23,53,32,93,-32,-85
all dw 6;所有数据的个数
jishu db 0
oushu db 0
data ends
codesg segment
start:
mov ax,data
mov ds,ax
mov cx,all
mov bx,0
mov jishu,0;对奇数计数器初始化
mov oushu,0;对偶数计数器初始化
s:
mov al,number[bx]
and al,1
cmp al,0
jz ok
inc jishu;是奇数
jmp short s0
ok:
inc oushu;是偶数
s0:
inc bx;指向下一个数
loop s
mov ax,4c00h
int 21h
codesg ends
end start
data segment
number db 23,53,32,93,-32,-85
all dw 6;所有数据的个数
jishu db 0
oushu db 0
data ends
codesg segment
start:
mov ax,data
mov ds,ax
mov cx,all
mov bx,0
mov jishu,0;对奇数计数器初始化
mov oushu,0;对偶数计数器初始化
s:
mov al,number[bx]
and al,1
cmp al,0
jz ok
inc jishu;是奇数
jmp short s0
ok:
inc oushu;是偶数
s0:
inc bx;指向下一个数
loop s
mov ax,4c00h
int 21h
codesg ends
end start