I don t know what is wrong with my code, what am I missing??? Pls, I need an explanation! Tk you!
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 br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
even = 0;
odd = 0;
while(a > 0){ // while a > 0;
int b = a % 10; //b = last digit of a
a /= 10; // a is now smaller with one digit(if a = 123 and b = 3 then a = 12) (while condition)
if( b / 2 == 0){
even++;
} else
odd++;
}
System.out.println("Even: "+ even + " Odd: "+ odd);
}
}