1 import java.util.Scanner; 2 3 public class Test13 { 4 public static void main(String[] args) { 5 Scanner scan = new Scanner(System.in); 6 int num, temp; 7 int[] arr = new int[10]; 8 int i, len; 9 10 num = scan.nextInt(); 11 temp = num; 12 i = 0; 13 while(temp > 0){ 14 arr[i++] = temp % 10; 15 temp /= 10; 16 } 17 len = i; 18 19 for(i=0; i<len/2; i++){ 20 if(arr[i] != arr[len-i-1]){ 21 break; 22 } 23 } 24 if(i >= len/2){ 25 System.out.println(num + " 是回文数"); 26 } 27 else{ 28 System.out.println(num + " 不是回文数"); 29 } 30 } 31 }