I'm getting the right answer but not fulfilling the requirements somehow. What am I missing?
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 {
//write your code here
int c;
int d;
int e;
int f;
int g;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x = Integer.parseInt(br.readLine());
if(x%2==0){
c = x/10000;
d = (x-10000*c)/1000;
e = (x-10000*c-1000*d)/100;
f = (x-10000*c-1000*d-100*e)/10;
g = (x-10000*c-1000*d-100*e-10*f);
} else {
return;
}
if (c%2==0){
even++;
} else {
odd++;
}
if (d%2==0){
even++;
} else {
odd++;
} if (e%2==0){
even++;
} else {
odd++;
} if (f%2==0){
even++;
} else {
odd++;
} if (g%2==0){
even++;
} else {
odd++;
}
System.out.println("Even: "+even+" Odd: "+odd);
}
}