Write an assembly language program to find the sum of the following series:
Sum = 1 + 2 + 3 + 4 + ......................... 100.
TITLE task.asm
; Description: The program to find the sum of the following
;series: Sum = 1 + 2 + 3 + 4 + ......................... 100
INCLUDE Irvine32.inc
.data
msgSum BYTE "Sum: ", 0
.code
main PROC
mov edx, OFFSET msgSum
call WriteString ; "Sum: "
mov ecx,100
xor eax, eax
mov ebx, 1
l1:
add eax, ebx
inc ebx
loop l1
quit:
call writeDec
call CrLf
call CrLf
Invoke ExitProcess, 0 ; exit
main ENDP
END main
Comments
Leave a comment