title: Long data type calculation in C
body: <p>I have a simple program that finds automorphic numbers up to given number. The problem is it just finds the number  which square parameter is bound of int.</p>
  
  <p>for example : 90625 x 90625 = 8212890625  but program could't find it.</p>
  
  <p>Question : What is the problem with long type here? It act like int. Is there a cast to int for the square parameter anywhere of the code?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void)
  {
     int n;
     long i;
  
     printf ("Enter a value:\n") ;
     scanf ("%d",&amp;n) ;
     printf ("Automorphic numbers:\n") ;
     for (i=1L ; i&lt;=n ; i = i+1L)
     {
         long square = i*i ;
  
         if (square % 10L == i || square % 100L == i || square % 1000L == i || square % 10000L == i || square % 100000L == i || square % 1000000L == i || square % 10000000L == i)
         printf ("%li\n", i) ;
     }
  }
  </code></pre>