计算1+2+……n=?,其中n通过键盘输入.要求用汇编语言中的循环程序设计来实现.

问题描述:

计算1+2+……n=?,其中n通过键盘输入.要求用汇编语言中的循环程序设计来实现.
要求在屏幕上提供如下信息:
Please input a number(1350):100 ;出现此信息后通过
\x05键盘输入一个小于628的无符号整数
The sum is:5050
1个回答 分类:综合 2014-11-13

问题解答:

我来补答
;1to100
include io32.inc
.data
msg1 byte 'Please input a number(1350):',0
msg2 byte 'This sum is:',0
.code
start:
mov eax,offset msg1
call dispmsg
call readsid
mov ecx,eax
mov eax,0
again:add eax,ecx
loop again
push eax
mov eax,offset msg2
call dispmsg
pop eax
call dispsid
exit 0
end start
 
 
展开全文阅读
剩余:2000