title: How do I Count the number of user inputs in this java code?
body: <p>So far I have,</p>
  
  <pre><code>package randomnumberguessinggame;
  import java.util.Scanner;
  
  public class RandomNumberGuessingGame {
  
  public static void main(String[] args) {
       int secretNumber;
          secretNumber = (int) (Math.random() * 999 + 1);
  
          Scanner keyboard = new Scanner(System.in);
          int guess;
          int count = 0;
          do {
                System.out.print("Enter a guess: (1-1000) ");
                guess = keyboard.nextInt();
                System.out.println("Your guess is " + guess);
                if (guess == secretNumber)
                      System.out.println("Your guess is correct. Congratulations!");
  
                else if (guess &lt; secretNumber)
                      System.out.println("Your guess is smaller than the secret number.");
  
                else if (guess &gt; secretNumber)
                      System.out.println("Your guess is greater than the secret number.");
  
          } while (guess != secretNumber);                         
      }
  }
  </code></pre>
  
  <p>This code works but I need to know how to count the number of user inputs.
  Thanks in advance.</p>