dap an 10 asm

Include C:\TASM\INCLUDE\Lib1.asm

.Model small

.Stack 100h

.Data

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

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

M3 db 13,10,'Hay vao u1 : $'

M4 db 13,10,'Tong cap so nhan la : $'

M5 db 13,10,'Gia tri bieu thuc la : $'

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

DauCham db '.$'

.Code

Main :

mov ax,@data

mov ds,ax

;clrscr

HienString M1

call Vao_So_N

mov cx,ax

mov di,cx

HienString M2

call Vao_So_N

mov bx,ax

HienString M3

call Vao_So_N

mov si,ax

dec cx

xor dx,dx

Tong :

mul bx

add si,ax

loop Tong

HienString M4

mov ax,si

call Hien_So_N

HienString M5

mov bx,di

Chia :

div bx

call Hien_So_N

and dx,dx

jz Finish

HienString DauCham

mov cx,2

mov si,10

ThapPhan :

mov ax,dx

mul si

div bx

call Hien_So_N

and dx,dx

jz Finish

loop ThapPhan

Finish :

HienString M6

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 256

.Data

Extrn _u : WORD , _v : WORD

.Code

Public @SoLon$qv

@SoLon$qv PROC

mov ax , _u

mov bx , _v

cmp ax,bx

jl NhoHon

jmp Exit

NhoHon :

mov ax,bx

Exit :

ret

@SoLon$qv Endp

End

2c:

#include<conio.h>

#include<iostream.h>

int u,v;

extern SoLon();

void main(void)

{

clrscr();

cout<<"

Nhap so thu nhat : ";

cin>>u;

cout<<"

Nhap so thu hai : ";

cin>>v;

cout<<"

So lon hon trong 2 so la : "<<SoLon();

getch();

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: #asm