title: how can i replace scanf with for loop counter?
body: <p>I am writing a program in order to count all achilles numbers without the math.h library. In this programm first I calculate powerful numbers after that I calculate GCD of powerful number. If GCD is 1 then the current number is achilles.</p>
  
  <p>My problem is that my program works with <code>scanf()</code> but not with for loop counter! What i am doing wrong?</p>
  
  <p>Thank you very much!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define MAX 1000
  
  int main(void)
  {
      int n;
      int i, j, a;
      int counter2 = 0;
      int large;
      int small;
      int rem, gcd, max = 1, min = 1;
      int achilles;
  
      for (a = 1; a &lt;= MAX; a++) //for loop for counter
      {
          n=a;
  
          for (i = 1; i &lt;= n; i++)
          {
              int count = 0;
              for (j = 1; j &lt;= i; j++)
              {
                  if (i % j == 0)
                  {
                      count++;
                  }
              }
              int l = 0;
  
              if (count == 2)
              {
                  while (n % i == 0) // calculate factor and his exponent
                  {
                      l++;
                      n = n / i;
                  }
  
                  if (l &gt; max) // calculates min and max in order to find GCD
                  {
                      max = l;
                  }
                  if (l &lt; min)
                  {
                      min = l;
                  }
              }
  
              large = max;
              small = min;
              while (small) { // While small is not 0
                              // Calculates GCD
                  rem = large % small;
                  large = small;
                  small = rem;
              }
              gcd = large;
              // printf("GCD(%d,%d)= %d", large, small, gcd);
          }
          if (gcd == 1) {
              achilles = n;
              // printf("%d\n", achilles);
          }
          // printf("GCD(%d,%d)= %d", max, min, gcd);
          printf("%d\n", achilles);
      }   
  }
  </code></pre>
  
  <p>The programm before editing with the for loop is the following!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define MAX 1000
  
  int main(void)
  {
      int n;
      int i, j, a;
      int counter2 = 0;
      int large;
      int small;
      int rem, gcd, max = 1, min = 1;
      int achilles;
      scanf("%d", &amp;n);
      printf("%d = ",n);
  
          for (i = 1; i &lt;= n; i++)
          {
              int count = 0;
              for (j = 1; j &lt;= i; j++)
              {
                  if (i % j == 0)
                  {
                      count++;
                  }
              }
              int l = 0;
  
              if (count == 2)
              {
                  while (n % i == 0) // calculate factor and his exponent
                  {
                      l++;
                      n = n / i;
                  }
  
                  if (l &gt; max) // calculates min and max in order to find GCD
                  {
                      max = l;
                  }
                  if (l &lt; min)
                  {
                      min = l;
                  }
              }
  
              large = max;
              small = min;
              while (small) { // While small is not 0
                              // Calculates GCD
                  rem = large % small;
                  large = small;
                  small = rem;
              }
              gcd = large;
              // printf("GCD(%d,%d)= %d", large, small, gcd);
          }
          /*if (gcd == 1) {
              achilles = n;
              // printf("%d\n", achilles);
          }*/
          printf("GCD(%d,%d)= %d", max, min, gcd);
          //printf("%d\n", achilles);
  }   
  </code></pre>