title: What is the largest prime factor of the number 600851475143?
body: <p>I want to know that what is the error in my code. </p>
  
  <pre><code>int main () {
  
  long long int number, large_factor=0, i=2;
  
  printf ("Enter a number : ");
  scanf ("%ld", &amp;number);
  
  while (number!=1) {
  
      if (number%i==0) {
  
          while (number%i==0) {
              printf ("%ld\t", i);
              number/=i;
          }
  
          large_factor=i;
      }
  
      i++;
   }
  
  printf ("\n\nThe largest prime factor is : %ld\n\n", large_factor);
  
  return 0;
  }
  </code></pre>
  
  <p>This code is running fine for smaller numbers but why it is failing for the large numbers?</p>