title: for loop with range
body: <p>I need to make a program that calculates for an entered N all prime numbers in a range from N-10 to N+10. I don't know what I'm doing wrong.Why Y is not increasing?</p>
  
  <pre><code>    #include &lt;iostream&gt;
      #include &lt;cmath&gt;
      using namespace std;
      int main(){
      int N, Y;
      bool Prime=true;
      cout&lt;&lt;"Enter N: ";
      cin&gt;&gt;N;
      Y=N;
      for (int i=1; i&lt;=N+10;i++){
           for(int k = 2; k &lt;= sqrt(Y); k++,Y++){
               if(Y%k== 0) {
               Prime = false;
               }
           }
           if(Prime &amp;&amp; Y&gt;1)
           cout&lt;&lt; "Number " &lt;&lt;Y
           &lt;&lt; " is Prime."&lt;&lt;endl;
           }
   }
  </code></pre>