Answer:
The program written in Java is given in the explanation section
Explanation:
<em>import java.util.Scanner;</em>
<em>public class num3 {</em>
<em> public static void main(String[] args) {</em>
<em> Scanner in = new Scanner(System.in);</em>
<em> System.out.println("This program counts evens and odds");</em>
<em> System.out.println("To exit enter ZERO or a NEGATIVE number");</em>
<em> int num = in.nextInt();</em>
<em> int numEvens=0;</em>
<em> int numOdds = 0;</em>
<em> while(num>=1){</em>
<em> if(num%2==0){</em>
<em> numEvens++;</em>
<em> }</em>
<em> else{</em>
<em> numOdds++;</em>
<em> }</em>
<em> System.out.println("Enter the next number");</em>
<em> num = in.nextInt();</em>
<em> }</em>
<em> System.out.println(numEvens+" even numbers and "+numOdds+" odd numbers");</em>
<em> }</em>
<em>}</em>