You are on page 1of 1

;SHWETHA R 1MS09TE053 ;Program to find GCD of a number .model small .

data num1 dw 0011h num2 dw 0007h gcd dw 1 dup(0) .code mov ax,@data mov ds,ax mov ax,num1 mov bx,num2 back1:cmp ax,bx jz loc1 jb loc2 back:mov dx,0000h div bx cmp dx,0000h jz loc1 mov ax,dx jmp back1 loc2:xchg ax,bx jmp back loc1: mov gcd,bx mov ah,4ch int 21h end

RESULT: ><gcd.dat >l >g Program terminated normally (3) > dw num1 l1 4400:000C 0011 > dw num2 l1 4400:000E 0007 > dw gcd l2 4400:0010 0001 424E >q

You might also like