title: Finding Prime numbers from 1 to 300 in C
body: <p>I have typed the following program in C language:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main ()
  {
      int i = 1, a = 2;
      while (i &lt;= 300)
      {
          while (a &lt; i)
          {
              if (i % a == 0)
                  break;
              else
                  printf ("%d\n", i);
              a++;
          }
          i++;
      }
      return 0;
  }
  </code></pre>
  
  <p>The program is printing many non-prime values too like <code>295</code>, <code>275</code>, etc...
  Please help, I'm a beginner and lacks much experience.                         </p>