Google

Dec 14, 2008

program to find the sum of cubes of n numbers

program to find the sum of cubes of n numbers

initially we load the si and di registers and we initalize ax and cx registers to zero. we move ax to content of di and move contents of si to cl. the we continue to increment si and move si to al and multiply the current result with al. Then we move contents of si to that of bl and we multiply bl and add the result in ax to that of di and we repeat this till the loop ends

the code can be analyzed as follows

mov si,2000
mov di,4000
mov ax,0
mov cx,0
mov [di],ax
mov cl,[si]
inc si
mov al,[si]
mul al
mov bl,[si]
mul bl
add [di], ax
loop continue
int a5

No comments: