汇编语言计算S=1+2*3+3*4+4*5+…..+N*(N+1)直到N*(N+1)>56

2024-12-12 01:46:31
推荐回答(1个)
回答1:

DATA SEGMENT
N DB 2
S DB 1
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
S: MOV AL,N
INC N
MUL N
ADD S,AL
CMP AL,56
JA FINISH
JMP S
FINISH: MOV AX,4C00H
INT 21H
CODE ENDS
END START