title: Not getting desired output of print statement
body: <p>In a second input "Enter a score. -1 to quit: " is missing and when a program end it appears.How to fix it?
  Also, if there's a better way to write this program.</p>
  
  <pre><code>import java.util.Scanner;
  public class l
  {
      public static void main(String[] args)
      {
          Scanner in = new Scanner(System.in);
          int avgScore = 0;
          int entry = 0;
          int totalScore = 0;
          do
          {
              System.out.print("Enter a score. -1 to quit: ");
              int score= in.nextInt();
              if(score == -1)
              {
                  break;
              }
              else
              {
                  totalScore +=score;
                  entry++;
              }
          }
          while (in.hasNextInt());
  
      }
  }
  </code></pre>