;;TRIANGLE.ASM ;;Link with ml triangle.asm util.lib ;;if a+b > c for all 3 sides, the sides form a triangle ;;pg 131 5.3 ;; ;; Can't assemble this: ? INCLUDE PCMAC.INC .MODEL SMALL .586 .STACK 100h .DATA Prompt DB 'Enter a number: $' OutMsg1 DB 'The sides make a traingle. $' OutMsg2 DB 'The sides don't make a triangle. $' A DB ? B DB ? C DB ? .CODE EXTRN GetDec : NEAR Triangle PROC mov cx,3 GoLoop: _Begin _PutStr Prompt call GetDec push ax dec cx jnz GoLoop pop C pop B pop A mov dx,C add dx,B cmp dx,A ;is C+B>A jng Done mov dx,B add dx,A cmp dx,C ;is B+A>C jng Done mov dx,A add dx,C cmp dx,B ;is A+C>B jng Done _PutStr OutMsg1 Done: _PutStr OutMsg2 _Exit 0 Triangle ENDP END Triangle