title: How should i solve counting problem in my divisor program C++
body: <p>hi guys i recently started learning C++ and today i got a problem with counting divisors in this program
  i want my program to count the number of divisors exactly but the output show weird numbers :/</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main(void)
  {
      int Lowest;
      int Highest;
      int count = 0;
  
      cout &lt;&lt; &quot;Enter The Lowest Number Of Series: &quot;;
      cin &gt;&gt; Lowest;
      cout &lt;&lt; &quot;Enter The Highest Number Of Series: &quot;;
      cin &gt;&gt; Highest;
  
      cout &lt;&lt; &quot;\n Number -&gt; Divisors ((count)) \n&quot;;
  
      for (int i = Lowest; i &lt;= Highest; i++)
      {
          cout &lt;&lt; &quot; &quot; &lt;&lt; i &lt;&lt; &quot; -&gt;&quot;;
          for (int j = 1; j &lt;= i; j++)
          {
              if (i % j == 0)
              {
                  count++;                                                              // WTF 
                  cout &lt;&lt; &quot; &quot; &lt;&lt; j;
              }
          }
          cout &lt;&lt; &quot; (( count:&quot; &lt;&lt; count &lt;&lt; &quot; )) &quot; &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>
  <p>for example out put for Lower=1 to Highest=10 is like this:</p>
  <pre><code>Enter The Lowest Number Of Series: 1
  Enter The Highest Number Of Series: 10
  
  Number -&gt; Divisors ((count))
   1 -&gt; 1 (( count:1 ))
   2 -&gt; 1 2 (( count:3 ))
   3 -&gt; 1 3 (( count:5 ))
   4 -&gt; 1 2 4 (( count:8 ))
   5 -&gt; 1 5 (( count:10 ))
   6 -&gt; 1 2 3 6 (( count:14 ))
   7 -&gt; 1 7 (( count:16 ))
   8 -&gt; 1 2 4 8 (( count:20 ))
   9 -&gt; 1 3 9 (( count:23 ))
   10 -&gt; 1 2 5 10 (( count:27 ))
  </code></pre>
  <p>Do you guys have any idea What is Wrong?</p>