EvenOdd.java - import [email protected] Jiacheng [email protected] 1.0 public class EvenOdd public static void main(String args boolean kkk = true

EvenOdd.java - import [email protected] Jiacheng...

This preview shows page 1 out of 1 page.

import java.util.Scanner; /** * @author Jiacheng Ding * @version 1.0 */ public class EvenOdd { public static void main(String[] args) { boolean kkk = true; Scanner scnr = new Scanner(System.in); String a; String b; int even = 0; int odd = 0; a = "p"; while (kkk) { if (scnr.hasNextInt()) { a = scnr.nextLine(); int c = Integer.parseInt(a); if (c % 2 == 0) { even = even + 1; } else { odd = odd + 1; } } else { kkk = false; } } if (odd > even) { System.out.println("O"); } else if (even > odd) { System.out.println("E"); } else { System.out.println("="); } } }

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture