Write a java Program to check given number is palindrome number or not


package com.java2study;

public class NumberPalindrome {


public static void reverseNum(int number){
int reminder;
int reverse = 0;
int palindrome = number;
while(number>0){
reminder = number%10;
number = number/10;
reverse = (reverse*10)+reminder;
}
System.out.println(reverse);
if(reverse == palindrome)
{
System.out.println("the given number is palindrome number");
}
else
{
System.out.println("The given number is not palindrome number");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
NumberPalindrome.reverseNum(132);

}

}

Output


231
The given number is not palindrome number

No comments:

Post a Comment