输入一个整数,判断他是奇数还是偶数并分别显示odd活着even
发布网友
发布时间:2022-05-08 01:00
我来回答
共1个回答
热心网友
时间:2023-11-22 21:57
DATA SEGMENT
MSG1 DB 'PARTY','$'
MSG2 DB 'ODD','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AH,00H
INT 16H ;接受一个数
SUB AL,30H
MOV BL,2
DIV BL
CMP AH,0;除2看余数为零否
JNZ OP
MOV DX,OFFSET MSG1;为零输出PARTY
MOV AH,09H
INT 21H
JMP EXIT
OP:;否则输出ODD
MOV DX,OFFSET MSG2
MOV AH,09H
INT 21H
EXIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START
热心网友
时间:2023-11-22 21:57
DATA SEGMENT
MSG1 DB 'PARTY','$'
MSG2 DB 'ODD','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AH,00H
INT 16H ;接受一个数
SUB AL,30H
MOV BL,2
DIV BL
CMP AH,0;除2看余数为零否
JNZ OP
MOV DX,OFFSET MSG1;为零输出PARTY
MOV AH,09H
INT 21H
JMP EXIT
OP:;否则输出ODD
MOV DX,OFFSET MSG2
MOV AH,09H
INT 21H
EXIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START
热心网友
时间:2023-11-22 21:57
DATA SEGMENT
MSG1 DB 'PARTY','$'
MSG2 DB 'ODD','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AH,00H
INT 16H ;接受一个数
SUB AL,30H
MOV BL,2
DIV BL
CMP AH,0;除2看余数为零否
JNZ OP
MOV DX,OFFSET MSG1;为零输出PARTY
MOV AH,09H
INT 21H
JMP EXIT
OP:;否则输出ODD
MOV DX,OFFSET MSG2
MOV AH,09H
INT 21H
EXIT:
MOV AH,4CH
INT 21H
CODE ENDS
END START