package com.codegym.task.task06.task0606; import java.io.*; /* Even and odd digits */ public class Solution { public static int even; public static int odd; public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s = reader.readLine(); int number = Integer.parseInt(s); checkNumber(number); System.out.println("Even: " + even + " Odd: " + odd); } public static int checkNumber(int number){ // method for a four digit number if((number / 1000) % 2 == 0){ // the first of number even = even + 1; }else odd = odd + 1; if(((number / 100) - ((number / 1000) * 10)) % 2 == 0){ // the second of number even = even + 1; }else odd = odd + 1; if(((number / 10) - ((number / 1000) * 100) - ((number / 1000) * 10)) % 2 == 0){ // the third of number even = even + 1; }else odd = odd + 1; if ((number - ((number / 10) * 10)) % 2 == 0) { // the fourth of number even = even + 1; }else odd = odd + 1; return 0; } //write your code here }