# Classify Numbers in Java

The following Java program application counts the number of odd and even numbers. The program also counts the number of zeros. I will be using the JCreator IDE in developing the program. To start in this tutorial, first open the JCreator IDE, click new and paste the following code.
`import java.util.*;public class ClassifyNumbers{	static Scanner console = new Scanner (System.in); 	static final int N = 20; 	public static void main (String[] args)	{		//declare variables 		int counter;  //loop control variable		int number; //variable to store the new number 		int zeros = 0;		int odds = 0;		int evens = 0; 		System.out.println("Please enter " + N			+ " integers, positive, negative, or zeros: "); 			for (counter = 1; counter <= N; counter++)			{				number  = console.nextInt();				System.out.print(number + " "); 				switch (number % 2)				{					case 0: evens++;						if (number == 0)							zeros++;					break;					case 1:						case -1: odds++;				}			}			System.out.println();			System.out.println("There are " + evens + "evens "				+ "which also includes " 					+ zeros + " zeros");			System.out.println("Total number of odds is: " + odds);	}}`
Sample run:
`Please enter 20 integers, positive, negative, or zeros: 1 2 3 4 5 6 7 8 9 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 01 2 3 4 5 6 7 8 9 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 0 There are 10evens which also includes 2 zerosTotal number of odds is: 10`
The program work as follows: The statement
` System.out.println("Please enter " + N			+ " integers, positive, negative, or zeros: "); prompts the user to enter integers, positive, negative or zero numbers. The statement <java number  = console.nextInt();				System.out.print(number + " ");`
gets the next number and outputs the number. The statement ` for (counter = 1; counter <= N; counter++)` process and analyze the 20 numbers. The statement
` System.out.println("There are " + evens + "evens "				+ "which also includes " 					+ zeros + " zeros");			System.out.println("Total number of odds is: " + odds);`
print the result and output the values of the variables zeros, evens and odds.