Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INCLUDE io.h
- cr EQU 0dh
- lf EQU 0ah
- data SEGMENT
- x DB ?
- y DB ?
- a DB ?
- b DB ?
- res DW ?
- prompt1 DB 'enter the value of x',0
- prompt2 DB 'enter the value of y',0
- prompt3 DB 'enter the value of a',0
- prompt4 DB 'enter the value of b',0
- string DB 40 DUP(?)
- lab DB cr,lf,'the result is'
- sum DB 6 DUP(?)
- DB cr,lf,0
- data ends
- code SEGMENT
- ASSUME cs:code,ds:data
- start:MOV AX,SEG data
- MOV DS,Ax
- prompt: output prompt1
- inputs string,40
- atoi string
- MOV x,AL
- output prompt2
- inputs string,40
- atoi string
- MOV y,AL
- output prompt3
- inputs string,40
- atoi string
- MOV a,AL
- output prompt4
- inputs string,40
- atoi string
- MOV b,AL
- MOV AL,x
- ADD AL,y
- MOV BL,a
- SUB BL,b
- MOV CL,a
- ADD CL,b
- MOV DL,x
- SUB DL,y
- MUL BL
- MOV BX,AX
- MOV AL,CL
- MUL DL
- MOV CX,AX
- MOV DX,0
- MOV AX,BX
- CWD
- DIV CX
- itoa sum,AX
- output lab
- quit: MOV AL,0
- MOV AH,4ch
- int 21h
- code ends
- END start
Advertisement
Add Comment
Please, Sign In to add comment