1 / 4

Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value.

Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value. Store 5 into AL Store BL into 2 Divide AL Into BL Store AL into Ans Store AH into Remainder Display ANS , Remainder value . Stop program. Start. AL = 5. BL=2. ANS= AL / BL.

Download Presentation

Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value. • Store 5 into AL • Store BL into 2 • Divide AL Into BL • Store AL into Ans • Store AH into Remainder • Display ANS , Remainder value . • Stop program Start AL = 5 BL=2 ANS= AL / BL REMAINDER = AH Display ANS, Remainder End

  2. Example Program MOV AH,2 MOV DL,ANS INT 21H MOV DL,REM INT 21H MOV AH,4CH INT 21H Main Endp End main .model small .stack 100h .data ANS db 0 REM db 0 .code Main proc MOV AX,@DATA MOV DS,AX MOV AL,5 MOV BL,2 DIV BL MOV ANS,AL MOV REM ,AH ADD ANS,30H ADD REM,30H

  3. .model small .stack 100h .data msg1 db 0ah,0dh,"Enter Number in No1 : $" msg2 db 0ah,0dh,"Enter Number in No2 : $" res db0ah,0dh,“Divide answer is : " No1 db? symole1 db " /" No2 db ? symbole2 db "=" Ansdb? remmesdb " and Remainder is " rem db ?,"$" .code Main proc movax,@data movds,ax mov ah,9 lea dx,msg1 int 21h • movah,1 • int 21h • sub al,30h • movNo1,al • movah,9 • lea dx,msg2 • int 21h • mov ah,1 • int 21h • sub al,30h • mov No2,al • mov ax,0 • mov al,No1 • div No2 • movAns,al • movrem,ah

  4. add Ans,30h • add No1,30h • add No2,48 • add rem,48 • movah,9 • lea dx,res • int 21h • mov ah,4ch • int 21h • main endp • end main

More Related