dap an 7 asm
Include C:\TASM\INCLUDE\Lib1.asm
.Model small
.Stack 100h
.Data
M1 db 13,10,'Hay vao N : $'
M2 db 13,10,'Tong tu 1 den $'
M3 db ' la : $'
M4 db 13,10,'Gia tri bieu thuc la : $'
DauCham db '.$'
.Code
Main :
mov ax,@data
mov ds,ax
HienString M1
call Vao_So_N
HienString M2
call Hien_So_N
HienString M3
mov cx,ax
mov bx,ax
xor ax,ax
Tong :
add ax,cx
loop Tong
call Hien_So_N
HienString M4
add bx,2
xor dx,dx
div bx
call Hien_So_N
and dx,dx
jz Finish
mov si,10
mov cx,3
HienString DauCham
ThapPhan :
mov ax,dx
mul si
div bx
call Hien_So_N
and dx,dx
jz Finish
loop ThapPhan
Finish :
mov ah,4ch
int 21h
Include C:\TASM\INCLUDE\Lib2.asm
End Main
2a:
.Model small
.Stack 100h
.Data
Extrn _n : WORD, _Array : DWORD
.Code
Public @TongChan$qv
@TongChan$qv PROC
mov cx,_n
mov ax,SEG _Array
mov bx,OFFSET _Array
mov es,ax
xor ax,ax
XuLy :
mov dx,es:[bx]
mov si,dx
shr dx,1
jc SoLe
add ax,si
SoLe :
add bx,2
loop XuLy
ret
@TongChan$qv Endp
End
2c:
#include<conio.h>
#include<iostream.h>
int Array[100];
int n;
extern int TongChan();
void main(void)
{
clrscr();
int i;
cout<<"Nhap so luong phan tu cua day so : ";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Phan tu thu "<<i+1<<" : ";
cin>>Array[i];
}
cout<<"
Tong cac thanh phan chan cua day : "<<TongChan();
getch();
}
3:
Include C:\TASM\INCLUDE\Lib1.asm
.Model small
.Stack 100h
.Data
M1 db 13,10,'Cong may in noi tiep ? $'
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 al,ah
mov cl,6
shr al,cl
jc TonTai
HienString No
jmp LPT
TonTai :
HienString Yes
LPT :
HienString M2
add al,30h
mov ah,0eh
int 10h
mov ah,1
int 21h
mov ah,4ch
int 21h
Include C:\TASM\INCLUDE\Lib2.asm
End Main
Bạn đang đọc truyện trên: Truyen247.Pro