title: Could someone tell me why the program does not return any int k in the end?
body: <p>I am working on this exercise: A sequence of n integers, each no greater than 1000 (by absolute value), is given. Write program divisors, which finds how many of the given integers have the following property: the integer is divided exactly by m positive divisors (each divisor should not be equal to 1, or to the integer itself).   </p>
  
  <p>The result should look like this:
  Input:  7 4<br>
          6 20 12 64 1024 50 24<br>
  Output: 3<br>
  Explanation: The elements of the given sequence with exactly 4 divisors are 20, 12 and 50. </p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  bool divisors(int a, int m) {
      int br = 0;
      for (int i = 2; i &lt; a; ++i) {
          if (a % i == 0)br++;
          if (br == m) return 1;
          else return 0;
      }
  
  
  }
  
  int main() {
      int n; // the number of elements
      int m; // the number of divisors
      int a, i, k = 0;
  
      cin &gt;&gt; n &gt;&gt; m;
  
  
      for (i = 1; 1 &lt;= n; i++) {
          cin &gt;&gt; a;
          if (divisors(a, m)) k++;
      }
  
      cout &lt;&lt; k &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>