Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern printf
- extern fflush
- extern scanf
- section .data
- fmt db "%d %d %d %d", 0
- fmtPrint1 db "A", 10, 0
- fmtPrint2 db "B", 10, 0
- fmtPrint3 db "C", 10, 0
- fmtPrint4 db "D", 10, 0
- fmtPrint5 db "E", 10, 0
- section .bss
- a resd 1
- b resd 1
- c resd 1
- d resd 1
- section .text
- global main
- main:
- ;input
- push a
- push b
- push c
- push d
- push fmt
- call scanf
- add esp, 20
- ;penjumlahan
- mov eax, [a]
- add eax, [b]
- add eax, [c]
- add eax, [d]
- mov edx, 0
- mov ecx, 4
- div ecx
- cmp eax, 80
- jae satu
- cmp eax, 60
- jae dua
- cmp eax, 50
- jae tiga
- cmp eax, 40
- jae empat
- cmp eax, 0
- jae lima
- satu:
- push eax
- push fmtPrint1
- call printf
- add esp, 8
- push 0
- call fflush
- jmp exit
- dua:
- push eax
- push fmtPrint2
- call printf
- add esp, 8
- push 0
- call fflush
- jmp exit
- tiga:
- push eax
- push fmtPrint3
- call printf
- add esp, 8
- push 0
- call fflush
- jmp exit
- empat:
- push eax
- push fmtPrint4
- call printf
- add esp, 8
- push 0
- call fflush
- jmp exit
- lima:
- push eax
- push fmtPrint5
- call printf
- add esp, 8
- push 0
- call fflush
- jmp exit
- exit:
- mov eax, 1
- mov ebx, 0
- int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement