Be sure that the number of even digits is stored in the variable even.
Be sure that the number odd digits is stored in the variable odd.
I know I am checking if the inputted number is even or odd but I am not sure how to store the inputted even digits in the variable even or same for odd digits
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));
int num = Integer.parseInt(reader.readLine());
int even = 0;
int odd = 0;
while(num > 0){
if(num % 2 == 0)
even++;
else
odd++;
num = num/10;
}
System.out.println("Even: " + even + " " + "Odd: " + odd);
}
}