org 0x0100 jmp start student_id db 1,2,3,4,5,6,7,8,9, id_length equ 9 sum_result dw 0 start: xor ax, ax ; Clear AX register xor si, si ; Clear SI register calculate_sum: mov al, [student_id + si] ; Move the value from student_id array to AL add ah, al ; Add AL to AH inc si ; Increment SI cmp si, id_length ; Compare SI with id_length jl calculate_sum ; If SI < id_length, jump to calculate_sum mov [sum_result], ah ; Store AH in sum_result ; Check if the sum is divisible by 3 mov ax, sum_result ; Move sum_result to AX xor dx, dx ; Clear DX for division mov bx, 3 ; Divisor is 3 div bx ; Divide AX by BX cmp dx, 0 ; Compare the remainder with 0 je divisible ; If remainder is 0, jump to divisible mov dx, 0 ; Set DX to 0 (not divisible by 3) jmp done ; Jump to done divisible: mov dx, 1 ; Set DX to 1 (divisible by 3) done: mov ax, 4C00h ; Exit program int 21h 1,2,3,4,5,6,7,8,9 ke jga apni id likhna
code?
org 0x0100
jmp start
student_id db 1,2,3,4,5,6,7,8,9,
id_length equ 9
sum_result dw 0
start:
xor ax, ax ; Clear AX register
xor si, si ; Clear SI register
calculate_sum:
mov al, [student_id + si] ; Move the value from student_id array to AL
add ah, al ; Add AL to AH
inc si ; Increment SI
cmp si, id_length ; Compare SI with id_length
jl calculate_sum ; If SI < id_length, jump to calculate_sum
mov [sum_result], ah ; Store AH in sum_result
; Check if the sum is divisible by 3
mov ax, sum_result ; Move sum_result to AX
xor dx, dx ; Clear DX for division
mov bx, 3 ; Divisor is 3
div bx ; Divide AX by BX
cmp dx, 0 ; Compare the remainder with 0
je divisible ; If remainder is 0, jump to divisible
mov dx, 0 ; Set DX to 0 (not divisible by 3)
jmp done ; Jump to done
divisible:
mov dx, 1 ; Set DX to 1 (divisible by 3)
done:
mov ax, 4C00h ; Exit program
int 21h 1,2,3,4,5,6,7,8,9 ke jga apni id likhna