Assignment 2 Solution File cs401
Assignment 2 Solution File cs401
jmp start
MSG1 db '$'
Co_Code db 'cs401$'
sum: dw 0
clrscr:
mov al, 0
mov cx, 00
mov dh, 24
mov dl, 79
int 10h
ret
sum_id:
mov bx, 0
mov cx, 9
mov ax, 0
sum_loop:
loop sum_loop
mov [sum], ax
mov cx, 10
mov bx, 10
mov di, -2
sub si, di
con_dig:
xor dx, dx
div cx
dec si
mov [si], dl
test ax, ax
jnz con_dig
mov dx, si
int 21h
ret
sum_str: times 2 db 0
start:
call clrscr
mov bh, 0
mov dh, 00h
int 10h
mov dx, Na
int 21h
int 21h
mov dx, Id
int 21h
int 21h
int 21h
int 21h
int 21h
int 21h
int 21h
call sum_id
int 21h
int 21h