section .data
student_id db 2, 2, 0, 4, 1, 6, 6, 0, 2 ; Your VU ID: BC220416602
sum db 0
result db 0
section .text
global _start
_start:
; Initialize registers
mov esi, student_id
mov ecx, 9 ; Number of digits
xor eax, eax ; Clear EAX for sum
sum_loop:
add al, [esi] ; Add digit to AL
inc esi ; Move to next digit
loop sum_loop ; Repeat for all digits
; Store the sum in memory
mov [sum], al
; Check if sum is divisible by 3
mov ah, 0 ; Clear AH
mov bl, 3 ; Divisor
cmp ah, 0 ; Check remainder
je divisible ; If remainder is 0, jump to divisible
not_divisible:
mov byte [result], 0
jmp end
divisible:
mov byte [result], 1
end:
; Exit program
mov eax
, 1 ; Syscall number
for exit xor ebx, ebx ; Exit code 0
int 0x80 ; Call kernel
section .bss
c2VjdGlvbiAuZGF0YQogICAgc3R1ZGVudF9pZCBkYiAyLCAyLCAwLCA0LCAxLCA2LCA2LCAwLCAyIDsgWW91ciBWVSBJRDogQkMyMjA0MTY2MDIKICAgIHN1bSBkYiAwCiAgICByZXN1bHQgZGIgMAoKc2VjdGlvbiAudGV4dAogICAgZ2xvYmFsIF9zdGFydAoKX3N0YXJ0OgogICAgOyBJbml0aWFsaXplIHJlZ2lzdGVycwogICAgbW92IGVzaSwgc3R1ZGVudF9pZAogICAgbW92IGVjeCwgOSAgICAgICAgICA7IE51bWJlciBvZiBkaWdpdHMKICAgIHhvciBlYXgsIGVheCAgICAgICAgOyBDbGVhciBFQVggZm9yIHN1bQoKc3VtX2xvb3A6CiAgICBhZGQgYWwsIFtlc2ldICAgICAgIDsgQWRkIGRpZ2l0IHRvIEFMCiAgICBpbmMgZXNpICAgICAgICAgICAgIDsgTW92ZSB0byBuZXh0IGRpZ2l0CiAgICBsb29wIHN1bV9sb29wICAgICAgIDsgUmVwZWF0IGZvciBhbGwgZGlnaXRzCgogICAgOyBTdG9yZSB0aGUgc3VtIGluIG1lbW9yeQogICAgbW92IFtzdW1dLCBhbAoKICAgIDsgQ2hlY2sgaWYgc3VtIGlzIGRpdmlza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