Palindrome Number:- Palindrome number is a number which is the same after reversed its digits. Like 16461,121 etc.
public static void main(String[] args) {
int num=16461,r,sum=0,temp;
temp=num;
while(num>0){
r= num%10;
sum= sum*10+r;
num = num/10;
}
if (temp==sum){
System.out.println("This is palindrom number");
}
else
{
System.out.println("This is not a palindrome number");
}
}
}
No comments:
Post a Comment