Find No is Prime or Consonant ~ Assembly Language

include irvine32.inc
.data
msg1 byte "Plese Enter the No to Find its Prime or not :",0,13h,10h
msg2 byte "No is Prime",0,13h,10h
msg3 byte "No is Consunant",0,13h,10h
num dword ?
loop1 dword ?
result dword ?
.code
main proc
call clrscr
call crlf
mov edx,offset msg1
call writestring
call readint
mov num,eax

mov loop1,eax
sub loop1,2
mov eax,loop1
mov ecx,eax
mov ebx,2

L1:
mov eax,num
mov edx,0
div ebx
mov result,edx

cmp result,0
je b
jne next
next:
inc ebx
loop L1

call crlf
mov edx,offset msg2
call writestring
jmp s
b:
call crlf
mov edx,offset msg3
call writestring
s:
exit
main endp
end main


No comments

Powered by Blogger.