Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to find whether the input number is prime or not

Posted By: Luki Fischer     Category: Assembly Language     Views: 16374

Write a program to find whether the input number is prime or not.

Code for Program to find whether the input number is prime or not in Assembly Language

DATA SEGMENT
A DB 04
B DB ?
DATA ENDS
CODE SEGMENT
         ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV AX,00
      MOV AL,A
      MOV CL,02
      DIV CL
      MOV B,AL
      MOV AH,00
      MOV CL,00
   L1:INC CL
      MOV AX,0000
      MOV AL,A
      DIV CL
      CMP AH,00
      JNZ L2
      INC CH
   L2:CMP CL,B
      JNE L1
      CMP CH,01
      JNE L3
      MOV DH,A
      MOV DL,00
      JMP L4
   L3:MOV DL,A
      MOV DH,00
   L4:MOV AH,4CH
      INT 21H
CODE ENDS
END START

;OUTPUT:->
;-G CS: 0041
;
;AX=0002  BX=0000  CX=0202  DX=0004  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0041   NV UP EI PL NZ NA PO NC
;0BA9:0041 B44C          MOV     AH,4C
  
Share: 


Didn't find what you were looking for? Find more on Program to find whether the input number is prime or not Or get search suggestion and latest updates.

Luki Fischer
Luki Fischer author of Program to find whether the input number is prime or not is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!