Hello, Can you please tell me where I am doing wrong in this code? The answers seem to right.
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
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String Sn = reader.readLine();
int xN = Integer.parseInt(Sn);
int x = xN > 0 ? xN : -xN; // find the absolute value if the entered number is negative
for(int i = 1; i <= x; i*=10){
int a = x/i;
if(a%2 == 0){
even++;
}
else{
odd++;
}
}
System.out.println("Even: "+even+" Odd: " + odd);
}
}