我需要一个 Java 程序来识别 10 到 99 之间的整数的相似数字。例如,如果我输入 23 和 62,则程序的输出应该是它们有相似的数字。我已经写了这个程序,但它不能正常工作
公共类问题{
public static void main(String[] args) {
Scanner scan = new Scanner (System.in) ;
int a = scan.nextInt() ;
int b = scan.nextInt() ;
int l = a%10 ;
int j = b%10 ;
int f = a%100 ;
int d = b%100 ;
if (a>99 && a<10 && b>99 && b<10) {
System.out.println("N/A") ;
}
if (l==j){
System.out.println("They have a similar digit");
}
else if(f==d){
System.out.println("They have a similar digit");
}
else if(l==d){
System.out.println("They have a similar digit");
}
else if(f==j){
System.out.println("They have a similar digit");
}
else
System.out.println("They don't have similar digit");
}
}