title: Trouble with prime number program in Assembly
body: <p>I am learning assembly language on x86 and made a simple programe that will tell number is prime or not.</p>
  
  <p>I think I am doing right but still not getting the desired result,below is code</p>
  
  <pre><code>section .bss
  b db
  section .data
  x db "Number is Prime",10,0
  y db "Number is not Prime",10,0
  z db "value is=%d",10,0
  
  section .text
  global main
  extern printf
  main:
  mov eax,17
  mov ebx,2
  loop:
  mov [b],eax
  div ebx
  mov eax,[b]
  cmp edx,0
  jz Print_not_Prime
  inc ebx
  
   cmp ebx,17
   jnz loop
   push x
   call printf
   add esp,4
   ret
  
   Print_not_Prime:
   push y
   call printf
   add esp,4
   ret
  </code></pre>
  
  <p>In above code I am checking with number 17 and output of programe telling its not prime number.</p>
  
  <p>Could anybody let me know where I am doing wrong</p>