用汇编,编写程序计算1+2+3+4+........+100并将结果显示在屏幕上
来源:百度知道 编辑:UC知道 时间:2024/06/17 08:50:07
急啊
code segment
assume cs:code
start:
mov ax,code
mov ds,ax
lea dx,mes
mov ah,9
int 21h
xor ax,ax
mov cx,100
add ax,cx
loop $-2;当前地址减去2就是上一条指令
xor cx,cx
mov bx,10
Q0:
xor dx,dx
div bx
or dx,0e30h
inc cx
push dx
cmp ax,0
jnz Q0
Q1:pop ax
int 10h
loop Q1
mov ah,1
int 21h
mov ah,4ch
int 21h
mes db '1+2+3+4+...+100=$'
code ends
end start
code segment
assume cs:code
start:
mov ax,code
mov ds,ax
xor ax,ax
mov cx,100
add ax,cx
loop $-2//当前地址减去2就是上一条指令
mov ax,4c00h
int 21h
code ends
end start
这是我认为的最简单的一种方式,其实还有其它的做法,这也是我在网上看到的,你看看吧!
汇编 用汇编编写一个求平均数的程序.
汇编编写大小写转换程序
用汇编编写的程序是怎么转化的?
用java编写程序,计算数学e的值,e=1+1/1!+1/2!+1/3!+...怎么编写啊
编写程序(Lib5.cpp),计算 1! + 2! + 3! +.... + N! 。要求:编写一个函数,参数设置为值参数。
用VB编写程序:计算1+2+3+........+100中所有偶数且为3的倍数的和~~~?
编写程序,计算和式: S=-1!+2!-3!+4! - …… + 10! 。 要求用循环语句实现。
用JAVA编写程序,计算1!+2!+3!+…+n!的和,其中阶乘的写一个方法实现。
编写程序计算 1^3+2^3+3^3+...+50^3
编写计算(1+2-3+4-5+。。。-(n-1)+n)的程序