title: getting stuck at c program how do I stop scanf in the middle of process
body: <p>I am writing a small program that takes input of country name which consist of 3 letters and the amount of medals the country has won in an Olympics and the program will keep asking for input unless the word "end" is entered. I wrote a while loop to do this however I can't seem to stop </p>
  
  <pre><code>//Program calculate the winner of olympics based on metal input
  #include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  int main (void)
  {
      int maxMedals=0, tempGold=0, tempSilver=0, tempBronze=0,tempSum;
      char country[3];
      char winner[3];
      printf("\no o o    O L Y M P I C    o o o");
      printf("\n o o      S C O R E S      o o\n");
      printf("Enter country code, # gold, # silver, # bronze\n");
      while ((strcmp(country,"end"))!=0)
      {
          printf("==&gt;");
          scanf("%s %d %d %d",&amp;country, &amp;tempGold, &amp;tempSilver, &amp;tempBronze);
          tempSum=tempGold+tempSilver+tempBronze;
          if (maxMedals&lt;tempSum)
          {
              maxMedals = tempSum;
              strcpy(winner, country);
              // printf("\n %s", winner);
          }
          else
          {
              maxMedals=maxMedals;
          }
      }
      printf("\nwe reached here\n");
      printf("\nWinner is %s with %d medals\n", country, maxMedals);
  
      return 0;
  }
  </code></pre>