title: Print statements keep printing out multiple times instead of just once?
body: <p>Here is my current code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(void)
  {
      char names[2048][32];
      int removed[2048];
  
      int game;
      int n;
  
      int m;
      int k;
      int l;
  
      int i;
      int j;
      int round;
      int pos;
  
      int lowest;
      int next;
  
      // Read the number of games to be played
      scanf("%d",&amp;n);
  
      // Process each game
      for(game = 1; game &lt;= n; game++)
      {
  
          // Read the number of friends
          scanf("%d",&amp;m);
  
          // Read the names of each friend
          for(i=0;i&lt;m;i++)
          {
              scanf("%s",names[i]);
  
              // Mark the friend as having not been eliminated
              removed[i] = 0;
          }
  
          // Read the number of rounds and the number of "Ducks"
          scanf("%d %d", &amp;k,&amp;l);
  
          // If the number of rounds is greater than the number of friends
          // Jimmy will boot all his friends
          if(k &gt;= m)
          {
              printf("Jimmy has friends no more.\n\n");
              continue;
          }
  
          // Simulate the game round by round
          pos = 0;
          for(round=0;round&lt;k;round++)
          {
              // Walk around the circle stopping at the lth remaining friend
              for(i=0; i&lt;=l; pos = (pos+1)%m)
              {
                  if(!removed[pos])
                      i++;
  
                  if(i == l+1)
                      // Give the friend we stopped at the boot
                      removed[pos]=1;
  
              }
          }
  
          lowest = 0;
          // Loop for each remaining friend
          for(i=0;i&lt;(m-k);i++)
          {
              // Find the lowest numbered remaining friend
              while(removed[lowest])
                  lowest++;
  
              // Find the friend with the first name alphabetically
              next = lowest;
              for(j=lowest;j&lt;m;j++)
              {
                  if(!removed[j] &amp;&amp; strcmp(names[j],names[next]) &lt; 0)
                      next = j;
              }
  
              // Print the name of the next friend and remove him/her from the circle
              removed[next] = 1;
              printf("Game %d:\n", game);
              printf("%s\n", names[next]);
          }
          printf("\n");
  
  
      }
      return 0;
  }
  </code></pre>
  
  <p>This is what it inputs and outputs:</p>
  
  <pre><code>Input:
  2
  3
  Bob
  Cody
  John
  2 2
  Game 1: (the output)
  Cody(the output)
  
  8
  Carol
  Casey
  Nick
  Kirsten
  Ben
  Bo
  Billy
  Heather
  3 4
  Game 2: (The output)
  Billy(The output)
  Game 2:(The output)
  Bo(The output)
  Game 2:(The output)
  Carol(The output)
  Game 2:(The output)
  Kirsten(The output)
  Game 2:(The output)
  Nick(The output)
  </code></pre>
  
  <p>How can I have the "Game 2:" printf statement only show up once? I've tried putting it in different parts of the code but I still haven't gotten it. For better understanding of what I'm trying to get, here is what I'm trying to do:</p>
  
  <pre><code>Output:
  Game 1:
  Cody
  Game 2:
  Billy
  Bo
  Carol
  Kirsten
  Nick 
  </code></pre>