Program in Assembly Language to check if number is Prime b\w (0 – 9)

Program in Assembly Language to check if number is Prime b\w (0 – 9)

ORG 100H
.MODEL SMALL
.STACK 100H
.DATA
AHSAN DB "ENTER NUMBER BETWEEN 0 & 9 ::: $"
AHSAN1 DB 0DH,0AH,"IT IS PRIME NUMBER $"
AHSAN2 DB 0DH,0AH,"IT IS NOT PRIME NUMBER $"
.CODE
LEA DX,AHSAN
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV BL,AL
CMP BL,02H
JE PRIME
CMP BL,03H
JE PRIME
CMP BL,05H
JE PRIME
CMP BL,07H
JE PRIME
JMP NOTPRIME
PRIME:
LEA DX,AHSAN1
MOV AH,09H
INT 21H
JMP PEND
NOTPRIME:
LEA DX,AHSAN2
MOV AH,09H
INT 21H
JMP PEND
PEND:
MOV AH,4CH
INT 21H
RET

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s