You are on page 1of 1

/**********************************************************************************

***********
Plaindrome Number:
Palindrome number in java: A palindrome number is a number that is same after
reverse.
For example 545, 151, 34543, 343, 171, 48984 are the palindrome numbers.
It can also be a string like LOL, MADAM etc.

***********************************************************************************
**********/
public class CheckPlaindrome{

//static method for checking a number for palendrome;


public static boolean isPalendrome(int n ) {
boolean pal= false;
int reversedNo=0;
int temp =n ;

while(n>0) {

reversedNo= (reversedNo*10)+ n%10;


n=n/10;
}
if( temp==reversedNo)
pal= true;
return pal;
}// end of method

//main method
public static void main(String [] args){
//dsiplaying all palindrome nunbers between 100 & 1000
for( int n=100;n<1000< n++){
if(isPalendrome(n))
System.out.print(n"\t");
}
}

}// end of class

You might also like