fork download
  1. section .data
  2. student_id db 2, 2, 0, 4, 1, 6, 6, 0, 2 ; Your VU ID: BC220416602
  3. sum db 0
  4. result db 0
  5.  
  6. section .text
  7. global _start
  8.  
  9. _start:
  10. ; Initialize registers
  11. mov esi, student_id
  12. mov ecx, 9 ; Number of digits
  13. xor eax, eax ; Clear EAX for sum
  14.  
  15. sum_loop:
  16. add al, [esi] ; Add digit to AL
  17. inc esi ; Move to next digit
  18. loop sum_loop ; Repeat for all digits
  19.  
  20. ; Store the sum in memory
  21. mov [sum], al
  22.  
  23. ; Check if sum is divisible by 3
  24. mov ah, 0 ; Clear AH
  25. mov bl, 3 ; Divisor
  26. div bl ; Divide AL by BL
  27. cmp ah, 0 ; Check remainder
  28. je divisible ; If remainder is 0, jump to divisible
  29.  
  30. not_divisible:
  31. mov byte [result], 0
  32. jmp end
  33.  
  34. divisible:
  35. mov byte [result], 1
  36.  
  37. end:
  38. ; Exit program
  39. mov eax, 1 ; Syscall number for exit
  40. xor ebx, ebx ; Exit code 0
  41. int 0x80 ; Call kernel
  42.  
  43. section .bss
  44.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty