CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 05:44:47 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=080937ef5ba4280ce08c5cde451fae23395ee49737062b4b18eab6846c75469aa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%227lU5sfhZoMCnfeDgGD4XQAzGgpQnmxSf%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d4498fdca4c1c9-BLR
LAB 3 (Take two input and print the two digit and their subtraction) - Pastebin.com
SHARE
TWEET

LAB 3 (Take two input and print the two digit and their subtraction)
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Write a program to
- ; (a) display a "?",
- ; (b) read two decimal digits whose sum "is less than 10
- ; (c) display them and their subtraction on the next line, with an appropriate message Simple Assembly Language Solution.
- .MODEL SMALL ; IN THIS COURSE ALL MODEL ARE SMALL
- .STACK 100H ; WE ALWAYS USE STACK 100H
- .DATA ; DATA SEGMENT
- STR1 DB 0AH,0DH,'THE SUBTRRACTION OF ' ; PRINT A NEW LINE AFTER TAKING INPUT SO WE USE 0AH,0DH
- FIRSTNUM DB ? ; TAKE A VARIABLE WHERE WE TAKE FIRST NUMBER
- STR2 DB ' AND ' ; ASSIGN A STRING IN STR 2
- SECONDNUM DB ? ; TAKING SENOCD NUMBER
- STR3 DB ' IS ' ; ASSIGN ANOTHER STRING IN STR3
- ANS DB ? ; TAKE A VARIABLE WHERE WE WILL PUT OUT SUMMATION, AND DO NOT END THE STRING BY $ SIGN
- STR4 DB ' $' ; ASSIGN $ HERE SO ALL AVOBE STRING ARE PRINT TOGETHER
- .CODE
- MAIN PROC ; MAIN CODE START HERE
- ;PROGRAMME SEGMENT PREFIX
- MOV AX,@DATA
- MOV DS,AX ; INITILATION OF DS
- MOV AH,2 ; PRINT SOME STRING
- MOV DL,3FH ; PRINT ? SIGN, WE CAN ALSO PRINT IT BY MOV DL,'?'
- INT 21H ; INTRUPT THE WORK
- MOV AH,1 ; TAKING SOME INPUT
- INT 21H ; INTRUPT THE WORK
- MOV BL,AL ; IF WE TAKE INPUT GENERALY GOES TO AL SO WE MOVE THE INPUT VALUE INTO BL.
- MOV FIRSTNUM,AL ; TAKE THE FIRST NUMBER INTO REGISTER
- INT 21H ; INTRUPT THE WORK
- MOV SECONDNUM,AL ; TAKE THE SECOND NUMBER INTO REGISTER
- SUB BL,AL ; HERE WE SUBTRACT BL AND AL
- ADD BL,30H ; TO COVERT ASCII TO DECIMAL WE ADDED 30 FROM SUBTRACT VALUE BL + 30 = BL , NOW IT IS DECIMAL.. CHECK ASCII TO UNDERSTAND BETTER
- MOV ANS,BL ; NOW MOVE THE VALUE INTO ANSWER
- MOV AH,9 ; PRINT STRING
- LEA DX,STR1 ; VARIABLE PRINTING FIRST TO LAST BECAUSE WE USE $ AT LAST. SO IT PRINT FIRST TO LAST
- INT 21H ; INTRUPT THE WORK
- MOV AX,4CH ; TERMINATED THE CODE AND EXIT
- INT 21H
- MAIN ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 6 sec ago | 0.10 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 7 sec ago | 0.25 KB
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 18 sec ago | 0.10 KB
-
✅⭐ Make huge profits on trading ⭐⭐ 9
JavaScript | 1 min ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 1 min ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ 8
JavaScript | 1 min ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ O
JavaScript | 1 min ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ 9
JavaScript | 1 min ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand