Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Bai 2: Tinh tong tu 1 den n.
- %include "io.inc"
- extern _printf
- extern _getch
- section .data
- tb1 db "Tinh tong tu 1 den n.",10,0
- tb2 db "Nhap n: ",0
- fmt db "%d",0
- fmt1 db "S = %d",0
- section .bss
- a resd 1
- b resd 1
- c resd 1
- section .text
- global CMAIN
- CMAIN:
- ;xuat tb1
- push tb1
- call _printf
- add esp,4
- ;nhap n
- push a
- push fmt
- call _scanf
- add esp,8
- ;goi ham
- je TinhTong
- ;Lay ket qua
- mov ebx,[b]
- ;xuat ket qua
- push dword [b]
- push fmt1
- call _printf
- add esp,8
- ;Ket thuc
- call _getch
- xor eax,eax
- ret
- TinhTong:
- xor
- mov eax,[a]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement