Hi!
I think that everything has to work out in my code. But CodeGym doesn't think so...what's wrong?
Thanks in advance:)
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 {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
sc.close();
int amount = count(a);
if (a % 2 == 0 && amount == 1) {
System.out.println("even single-digit number");
} else if (a % 2 != 0 && amount == 1) {
System.out.println("odd single-digit number");
} else if (a % 2 == 0 && amount == 2) {
System.out.println("even two-digit number");
} else if (a % 2 != 0 && amount == 2) {
System.out.println("odd two-digit number");
} else if (a % 2 == 0 && amount == 3) {
System.out.println("even three-digit number");
} else if (a % 2 != 0 && amount == 3) {
System.out.println("odd three-digit number");
}
}
public static int count(int a){
int county = 0;
while(a % 10 != 0){
county++;
a = a/10;
}
return county;
}
}