I'm a beginner in programming. Can you please tell me what's wrong with my code? The code shows not palindrome, although the number is a palindrome.
public static void main(String[] args) {
// TODO code application logic here
Scanner in = new Scanner(System.in);
int a =0;
int n =in.nextInt();
while(n >0){
int temp =n %10;
a = a*10+temp;
n = n/10;
}
System.out.println(a);
if( n ==a){
System.out.println("The number is palindrome");
}else{
System.out.println("The number is not palindrome");
}
}
Output:
16461
16461
The number is not palindrome