CS401 (Practical) Assignment # 1
Name: SHAHID AMEEN
VUID: BC210415570
Question:
Write an assembly language program that calculates the sum of all even
numbers from 1 to N, where N is the largest digit of your VUID. Use jumps
and labels to implement the necessary loops and conditionals. Store the final
sum in a variable named sum?
We write the code for display the result in the compiler your vu id sum:
Assembly language code:
[org 0x0100]
jmp start
number: db 7
sum: db 0
start:
mov bx,[number]
mov cx,7
mov ax,0
checking:
and bx,1
cmp bx,0
jnz skip
add ax,cx
skip:
sub cx,1
mov bx,cx
cmp cx,0
jnz checking
mov [sum],ax
mov ax,0x4c00 ;termination of program
int 0x21
sample screenshot with last four digits is as :
Sample screen shot of original vu id greatest number with sum: