I'm using the same syntax as the previous task where we identified even & odd numbers but it's not identifying the odd numbers. Is there an issue with the order?
Thanks!
package com.codegym.task.task04.task0427;
/*
Describing numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader num = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(num.readLine());
int count = 0;
while(a > 0){
a = a/10;
count++;
}
if (a % 2 == 0 && count == 1){
System.out.println("even single-digit number");
} else if (a % 2 != 0 && count == 1){
System.out.println("odd single-digit number");
} else if (a % 2 == 0 && count == 2){
System.out.println("even two-digit number");
} else if (a % 2 != 0 && count == 2){
System.out.println("odd two digit number");
} else if (a % 2 == 0 && count == 3){
System.out.println("even three-digit number");
} else if (a % 2 != 0 && count ==3){
System.out.println("odd three-digit number");
}
}
}