title: Trouble making a running total in C
body: <p>I'm new at programming, new on this site too, so hello...
  I'm attempting to obtain a running total for integers one thru 10, but I'm getting gibberish answers and I just can't understand why.
  To attempt to find out what was going wrong, I added the </p>
  
  <pre><code>printf(" running total is %d\n", sum);
  </code></pre>
  
  <p>line to the while loop, but just got more of the same nonsense...
  please see <a href="http://codepad.org/UxEw6pFU" rel="nofollow">http://codepad.org/UxEw6pFU</a> for the results....</p>
  
  <p>I'm sure this has a blindingly obvious solution...I'm just too dumb to see it though!
  anyone know what I'm doing wrong?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  int main(void)      {
  
      int count,sum,square;           
      int upto=10;                 
  
      count = 0;                
      square = 0;                 
  
      while (++count &lt; upto)   {   
          square = count * count;
          printf("square of %d is %d",count,square);     
          sum =square + sum;
          printf(" running total is %d\n", sum);
      }
  
      printf("overall total of squares of integers 1 thru 10 is %d\n", sum);           
  
      return 0;
  }
  </code></pre>