title: how can I count the number of odd, evens, and zeros in a multiple digit number in Java
body: <p>My program does not count 0 as an even number 
  And I don't want to use for statement just while loop
  thank you</p>
  
  <p>import java.util.*;</p>
  
  <p>public class DigitAnalyst {</p>
  
  <pre><code>public static void main(String[] args) {
      int  zero=0;
      int lastdigit;
  
      Scanner inputNumber= new Scanner(System.in);
      System.out.println("enter any number: ");
      int number = inputNumber.nextInt();
  
      while(number &gt; 0)
      {
  
           int zeros=0;
           int odds=0;
           int evens=0;
  
                 while(number &gt; 0)
  
                          {
                                   number=number/10;
                                   lastdigit=number%10;
  
  
  
                                   if (lastdigit==zero)
                                       zeros++;
                                   if (lastdigit % 2 == zero)
                                       evens++;
                                   if (lastdigit % 2 != zero)
                                       odds++;
                          }
  
                 System.out.println(odds +" odd digits");
                 System.out.println(evens +" even digits");
                 System.out.println(zeros +" zero digits");
         }
  
  }
  </code></pre>
  
  <p>}</p>