Write Assembly Program to Print Sum from 1 to 100 Numbers

0
1
digitalample eye
Write a Assembly Program to Print the Sum of Natural Numbers from 1 to 100.
Assembly Program to display the sum from 1 to 100.
Program to display sum 1 to 100.
ALP program to add and display sum of 1 to 100.

MASM Code

TITLE "TO PRINT THE SUM OF NATURAL NUMBERS FROM 1 TO 100"
.MODEL SMALL
.STACK
.DATA
VAL DB 1
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV BX,1
MOV CX,100
MOV AX,0

TOP:
ADD AX,BX
INC BX

LOOP TOP
XOR DX,DX
MOV BX,100
DIV BX


AAM
ADD AX,3030H
PUSH DX

MOV DH,AL
MOV DL,AH
MOV AH,02H
INT 21H

MOV DL,DH
MOV AH,02H
INT 21H


POP AX

AAM
ADD AX,3030H
PUSH DX

MOV DH,AL
MOV DL,AH
MOV AH,02H
INT 21H

MOV DL,DH
MOV AH,02H
INT 21H

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN

LEAVE A REPLY

Please enter your comment!
Please enter your name here