title: Adding Numbers Generated By Random Number Generator in C
body: <p>before I ask my question I would like to point out that I did look for the answers already, and I didn't find what I was looking for.
  Please bear in mind that I am a beginner in terms of programming, so please don't assume that I know everything there is to know.
  Right, to the question.
  My question is : How do I add together numbers that are created by random number generator ? The difficulty that I have is the fact that the number of randomly generated numbers could be different every time the program is ran. To make it clearer, the amount of randomly generated numbers is dependent on the input from user, eg if the input is 9, the program will generate 9 random numbers. This makes it difficult for me to come up with the idea of how to add the random numbers together and display them.
  Here is the source code from my program. I think it is important to mention that the random numbers change every time I run the program, which is how I want them to be ( I used srand() with time, and rand() ). Also, the problem that I have currently is that the program doubles the last randomly generated number instead of adding them all together.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  int main(void)
  {
      int input;
      scanf("%d", &amp;input);
      int i;
      int roll;
      int turn_total;
      time_t t;
      int sum;
  
      srand((unsigned) time(&amp;t));             // the seed for the random number generator based on the current time
  
      for( i = 0; i &lt; input; i++)
      {
          roll = (rand() % 6 + 1);            // random number generator 
          sum = roll+roll;                    // only dubbling the last roll for some reason = /
          printf("You Rolled : %d\n", roll);
      }
  
      printf("The Total Turn Score is : %d", sum);
  }
  </code></pre>
  
  <p>Any help, ideas or clues would be greatly appreciated.</p>