I'm not sure why the final condition errors. I have if a is less than 1 OR greater than 999 do nothing. It should work. Please tell me what I'm doing wrong.
Thank you
package com.codegym.task.task04.task0427;
/*
Describing numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner scan = new Scanner(System.in);
String x = scan.next();
int a = Integer.parseInt(x);
if((a%2 == 0) && (x.length() == 1)){
System.out.println("even single-digit number");
}else if(!(a%2 == 0) && (x.length() == 1)){
System.out.println("odd single-digit number");
}else if((a%2 == 0) && (x.length() == 2)){
System.out.println("even two-digit number");
}else if(!(a%2 == 0) && (x.length() == 2)){
System.out.println("odd two-digit number");
}else if((a%2 == 0) && (x.length() == 3)){
System.out.println("even three-digit number");
}else if(!(a%2 == 0) && (x.length() == 3)){
System.out.println("odd three-digit number");
}else if (a < 1 || a > 999)
{
// System.out.println();
}
}
}