私は&の間のPalindrome番号を見つけようとしています。コードに何らかのエラーがあります。私は問題が論理にあると思う。Palindromeの番号を見つける
import java.util.Scanner;
public class Palindrome {
public static void main(String[] args) {
int count = 0;
System.out.println("Enter the limit to check the no of Palindrome ");
Scanner input = new Scanner(System.in);
int no = input.nextInt();
for (int j = 0; j <= no; j++) {
if (number(j)) ;
++count;
}
System.out.println(count);
}
public static boolean number(int num) {
int i = num;
int reverse = 0;
while (i != 0) {
reverse = reverse * 10;
reverse = reverse + i % 10;
i = i/10;
}
if (num == reverse) {
return true;
} else
return false;
}
}
エラーをリストしてください。 –