title: C++ sum of numbers
body: <p>I got a problem with my program that should sum the numbers from 1 to 70000 (1+2+3+4+...+69999+70000). My program can sum the numbers up to 65535 without a problem, but for any summing above 65535, the result shows negative numbers, which is wrong. Can anyone explain to me why my program can not sum numbers above 65535?</p>
  
  <p>this is my code :</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void sum(int *s)
  {
      *s=0;
      int i=1;
      int n=70000;
      while(i&lt;=n)
      { 
          *s+=i; 
          i++;
      }   
  }
  
  main() 
  {
      int s;
      sum(&amp;s);
  
      printf("Suma prirodnih brojeva od 1 do 70000 je: %d\n",s);
  }
  </code></pre>