title: Division of a long long C type
body: <p>I need to use the 'long long' c type, to store data in a very large array. Since my code is large, I made up this fairly simple code which has the same problem. So, it iterates 222 times in the loop, and prints out when the loop reaches 50% (of storing values in the array) and 100% (when it's finished).  </p>
  
  <p>But it always gives me errors, for example in this case 50 % of the array should print the index 222/2 = 111 and 100% should print out index 222. However it always prints 100 and 200.</p>
  
  <p>This is the simple code I'm using a below are the results. </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #define S 222
  int main(void){
      char *text = calloc(S, sizeof(char));   
       unsigned long long i;
      for(i=0; i&lt;=S; i++){
      text[i] = 'a';
  
      if(i == (S/100)*50)) {printf("50percent\t and index : %llud index should be 111" ,i );}
      if(i == ((S/100)*100)){printf("100percent\t and index : %llud index should be 222", i);}        
  }
  return 0;
  }
  </code></pre>
  
  <p>So I was wondering, if I was doing something wrong or if there is a logic explanation to that problem. </p>
  
  <p>Thank you. </p>