palindrome number in java

Palindrome number program in java:

public class Palindrome{

 public static void main(String args[]){ 
  int rem,sum=0,temp;   
  int number=153;//The number variable to checked for palindrome  
  
  temp= number;   
  while(number >0){   
   rem = number %10;  // remainder 
   sum=(sum*10)+ rem;   
   number = number /10;   
  }   
  if(temp==sum)   
   System.out.println("palindrome number ");   
  else   
   System.out.println("not palindrome");   
}


output:

not palindrome              //153 is a not palindrome                      


EmoticonEmoticon