title: java loops, evens odds and zeros
body: <p>I am currently working on a program that counts the number of even, odds, and zeros in an user input number. I am having trouble with two things. One being I am not sure how to get the loop to continue until the sentinel number is entered, and the other is how do I count zeros as a zero and not an even number. Below is my code so far, Thank you in advance.</p>
  <pre><code>import java.util.Scanner;
  
  public class CountDigitsWithSentinel
  {
      
      public static void main(String[] args)
      {
        // Declare the identifiers
          final int SENTINEL = -99;
          int userInput;
          int oddNums = 0;
          int evenNums = 0;
          int numZeros = 0;
          // Declare the remaining identifiers ...
  
          Scanner scan = new Scanner(System.in);
          
          // Display the programmer's information
          
           
          
        System.out.println(&quot;Enter an integer value (-99 to end):&quot;);
         userInput = scan.nextInt();
          System.out.println(&quot;The number &quot; + userInput + &quot; contains&quot;);
          //Your code ...
         
          
          
           while (userInput &gt; 0) {
              
              int rem = userInput % 10;
              
              
              if (rem% 2 == 0) {
                 evenNums++;
              
           }
           
           else
           {
              oddNums++;
           }
              
              userInput = userInput / 10;
           }
          
          //Your code ...
          
          // Display the counts
        System.out.println(&quot;Zero digits: &quot; + numZeros);
        System.out.println(&quot;Even digits: &quot; + evenNums);
        System.out.println(&quot;Odd digits: &quot; + oddNums);
          //Your code ...
           
          System.out.println(&quot;Have a nice day!&quot;);
      
  }
  }
  </code></pre>