有些自己的改动,新手上路,多多关照
import java.util.Scanner;
public class oddeven {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int number = in.nextInt();
int countodd = 0;
int counteven = 0;
// do
// {
// if(number % 2 == 0)
// {
// counteven = counteven + 1; counteven++也可以(odd同理)
// }
// else
// {
// countodd = countodd + 1;
// }
// number = in.nextInt();
// }while(number>0&&number<100000);
while(number>0&&number<100000)
{
if(number % 2 == 0)
{
counteven = counteven + 1;
}
else
{
countodd = countodd + 1;
}
number = in.nextInt();
}
if(number+1==0)
{
System.out.println(countodd+" "+counteven);
}
else
{
System.out.println("输入有误!");
}
in.close();
}
}