Chào các bạn! Vì nhiều lý do từ nay Truyen2U chính thức đổi tên là Truyen247.Pro. Mong các bạn tiếp tục ủng hộ truy cập tên miền mới này nhé! Mãi yêu... ♥

dap an 11

Include C:\TASM\INCLUDE\Lib1.asm

.Model small

.Stack 100h

.Data

M1 db 13,10,'Hay vao a : $'

M2 db 13,10,'Hay vao n : $'

XuongDong db 13,10,'$'

M3 db ' luy thua $'

M4 db ' la : $'

M5 db 13,10,'Co tiep tuc CT ( C/K ) ? $'

.Code

Main :

mov ax,@data

mov ds,ax

;clrscr

HienString M1

call Vao_So_N

mov bx,ax ; bx = a

HienString M2

call Vao_So_N

mov cx,ax ; cx = n

mov dx,cx

HienString XuongDong ; start dong 3

mov ax,bx

call Hien_So_N

HienString M3

mov ax,cx

call Hien_So_N

HienString M4 ; end dong 3

mov ax,1

cmp dx,0

jz Finish

GiaiThua :

mul bx

loop GiaiThua

Finish :

call Hien_So_N

HienString M5

mov ah,1

int 21h

or al,20h

cmp al,'c'

jne Exit

jmp Main

Exit :

mov ah,4ch

int 21h

Include C:\TASM\INCLUDE\Lib2.asm

End Main

2a:

.Model small

.Stack 100h

.Data

Extrn _n : WORD , _q : WORD , _u1 : WORD

.Code

Public @CapSoNhan$qv

@CapSoNhan$qv PROC

mov cx, _n

mov ax, _u1

mov bx, _q

dec cx

mov si,ax

mov dx,0

Tong :

mul bx

add si,ax

loop Tong

mov ax,si

ret

@CapSoNhan$qv Endp

End

2c:

#include<conio.h>

#include<iostream.h>

int n;

extern int CapSoNhan();

int q;

int u1;

void main(void)

{

clrscr();

cout<<"Nhap so luong thanh phan : ";

cin>>n;

cout<<"

Nhap cong boi q : ";

cin>>q;

cout<<"

Nhap gia tri dau cua cap so nhan : ";

cin>>u1;

cout<<"

Tong cap so nhan la : "<<CapSoNhan();

getch();

}

3::

Include C:\TASM\INCLUDE\Lib1.asm

.Model small

.Stack 256

.Data

M1 db 13,10,'May tinh co FPU hay khong : $'

Yes db 'Co$'

No db 'Khong$'

M2 db 13,10,'So luong cong LPT : $'

.Code

Main :

mov ax,@data

mov ds,ax

HienString M1

int 11h

mov cl,2

shr al,cl

jc TonTai

HienString No

jmp LPT

TonTai :

HienString Yes

LPT :

HienString M2

mov al,ah

mov cl,6

shr al,cl

add al,30h

mov ah,0eh

int 10h

mov ah,1

int 21h

mov ah,4ch

int 21h

End Main

Bạn đang đọc truyện trên: Truyen247.Pro

Tags: #asm