title: Rolling Dice loop program in Java
body: <p>I'm trying to write a Rolling Dice program. How do I stop the loop after 10 times? </p>
  
  <p>It needs to return how many times the computer wins, the user wins or tie.</p>
  
  <p>And when the loop terminates how do I print who won overall?</p>
  
  <pre><code>    public static void main(String[] args)
      {
  
          int die1=(int)(Math.random()*6+1);
          int die2=(int)(Math.random()*6+1);
  
          int comp_wins = 0;
          int user_wins = 0;
          int tie = 0;
          int count = comp_wins + user_wins + tie;
  
          while (count &lt; 11)
          {
              if (die1 &gt; die2)
              {
                  comp_wins++;
                  System.out.println ("Computer Wins: " + comp_wins);
              }
              if (die2 &gt; die1)
              {
                  user_wins++;
                  System.out.println ("User Wins: " + user_wins);
              }
              else
                  tie++;
                  System.out.println ("Ties: " + tie);
          }       
  
          System.out.println ("The" + "wins overall!");
      }
  </code></pre>