Answer the question
In order to leave comments, you need to log in
How to form a new array from an array of numbers, which should include odd numbers?
Given an array of numbers X = 0.3, -15.19, -26.49, -61.18.55.4. It is necessary to form a new array Y, which should include odd numbers.
I did it following the example of a similar program, but something is wrong and I can’t understand where.
SDATA SEGMENT WORD PUBLIC 'DATA'
ARRAY_X DB 0,3,-15,19,-26,49,-61,18,55,4 ; - массив чисел X
ARRAY_Y DB 10 DUP(0) ; - массив чисел Y
SDATA ENDS
SSTACK SEGMENT PARA STACK 'STACK'
DW 64 DUP(?)
STACK_POINT LABEL WORD
SSTACK ENDS
START: MOV AX,SDATA
MOV DS,AX
MOV AX,SSTACK
MOV SS,AX
MOV SP,OFFSET STACK_POINT
MOV SI,0
MOV DI,0
MOV CX,10
M1: MOV AL,ARRAY_X[SI]
IDIV 2
CMP AL,2
JGE M2
MOV ARRAY_Y[DI],AL
INC DI
M2: INC SI
LOOP M1
MOV AX,4C00H
INT 21H
SCODE ENDS
END START
Answer the question
In order to leave comments, you need to log in
IDIV 2
CMP AL,2
JGE M2
M1: MOV AL,ARRAY_X[SI]
TEST AL, 1
JZ M2
MOV ARRAY_Y[DI],AL
INC DI
M2: INC SI
LOOP M1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question