title: integer type long and division
body: <p>I just write a procedure to decompose an unsigned integer to prime numbers. it will work normally if I define the data type as "<strong>int</strong>", if I change it to "<strong>long</strong>", result will be wrong. I don't know why.</p>
  
  <p>BTW, I used Win-TC as my compiler.</p>
  
  <p>Code as below:</p>
  
  <pre><code>#include "stdio.h"
  #define True    0xff
  #define False   0x00
  char DividerIsPrime(unsigned long data);
  void CheckIfDataCanBeExtracted(unsigned long data);
  main()
  {
      unsigned long data;
      printf("please input data:");
      scanf("%d",&amp;data);
      printf("\n%d=",data);
      CheckIfDataCanBeExtracted(data);
  //    printf("%d",sizeof(short));
      getch();
  }
  
  void CheckIfDataCanBeExtracted(unsigned long data)
  {
      unsigned long divider,temp,data1;
      data1=data;
      for(divider=2;divider&lt;=data;divider++)
      {
           temp=data1%divider;
           if(temp) {continue;  }
           if(DividerIsPrime(divider)) {
          data1 = data1/divider;
          printf("%d",divider);
          if(data1==1) break;
  
          else {printf("*");  divider--;}
  
  
        }
      }
      return;
  
  }
  
  /* Check if this number is a prime number */
  char DividerIsPrime(unsigned long data)
  {
      unsigned long divider;
      char    status=True;
      for(divider=2;divider&lt;data;divider++)
      {
          if(data%divider) status=True;
          else status=False;
      }
      return status;
  }
  </code></pre>
  
  <p>Thanks for Paul's help, I know where is wrong. %d should be replaced by %ld.</p>