/* Write a program segment that reads a sequence of integers until a 0 is encountered, and outputs the number of even integers and the number of odd integers read (not counting the final 0). For example, if the input is: 2 13 -7 21 -11 0 The code will read in all the integers, and produce the following output: Number of even integers: 1 Number of odd integers: 4 */ import java.util.Scanner; public class HW4q2b { public static void main(String[] args) { Scanner kb=new Scanner(System.in); int userInt=kb.nextInt(); int countEven=0; int countOdd=0; while (userInt!=0) { if (userInt%2==0) countEven++; else countOdd++; userInt=kb.nextInt(); } System.out.println("Number of even integers: "+countEven); System.out.println("Number of odd integers: "+countOdd); } }