Java

Program for Palindrome of a number

class PalindromeOfNumber 
{
 public static void main(String[] args) 
 {
  int original=12345;
  int o=original;//Stored for reference
  int reverse=0;

   while( original != 0 )
      {
          reverse = reverse * 10;
          reverse = reverse + original%10;
         original = original/10;
      }
  if (o==reverse)
  {
   System.out.println("Number is palindrome");
  }
  else
  {
   System.out.println("Number is not a palindrome");
  }
 }
}

Related Posts

language_img
Java

final keyword

Oct 8, 2013

Table Of Contents

;