Computer Science, asked by shashwat3345, 1 year ago

write a program in Java to check a number whether it is "palindrome" or not​

Answers

Answered by rakhithakur
5

Explanation:

class PalindromeExample{  

 public static void main(String args[]){  

  int r,sum=0,temp;    

  int n=454;//It is the number variable to be checked for palindrome  

  

  temp=n;    

  while(n>0){    

   r=n%10;  //getting remainder  

   sum=(sum*10)+r;    

   n=n/10;    

  }    

  if(temp==sum)    

   System.out.println("palindrome number ");    

  else    

   System.out.println("not palindrome");    

}  

}  

Similar questions