title: printing prime numbers using only loops and if statements
body: <p>What’s wrong with this code?</p>
  
  <pre><code>import math
  y=1
  z=y
  while z&gt;= 1 and z&lt;1000 :
      z= 2*y + 1
      y=y+1
      for a in range (2,int(math.sqrt(z) + 1)):
          if z%a != 0:
              print(z)
          else:
              break
  </code></pre>
  
  <p>What’s wrong here? I keep getting composite numbers as well in my output.</p>