Example3_12

posted Feb 1, 2014, 8:01 AM by dldar masud   [ updated Feb 1, 2014, 8:05 AM by Karwan Jacksi ]



import java.util.*;
public class Example3_12 {
static Scanner in = new Scanner(System.in);
  public static void main(String[] args) 
  {
  
                int num, count1 = 0, count2 = 0;
    
     while(true)
     {
        
                 System.out.print("Enter an int number:");
        num = in.nextInt();
        
                  if (num == 0)
           break;
      
                  if(num % 2 == 0)
           count1 ++;
        
              else
           count2 ++;
      }
      System.out.println("Even = " + count1 + ", Odd = " + count2);
  }

}

ċ
Example3_12.java
(1k)
Karwan Jacksi,
Feb 1, 2014, 8:01 AM
Comments