📜  java 布尔偶数 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:21.205000             🧑  作者: Mango

代码示例1
for (int i = 0; i < 5; i++) {
    System.out.println("Enter an integer.");
    x = in.nextInt();
    if (x % 2 == 0) {
        even++;
        System.out.println(x + " is even.");
    }
    if (x % 2  == 1) {
        odd++;
        System.out.println(x + " is odd.");
    }