class PalindromeNo
{
public static void main(String[] args)
{
int num, rem, rev, temp;
System.out.println(" \n3 Digit Palindrome numbers: \n");
for(num=100;num<=1000;num++)
{
temp=num;
rev=0;
while(temp>0)
{
rem=temp%10;
temp=temp/10;
rev=rev*10+rem;
}
if(num==rev)
System.out.print(" "+num);
}
}
}
No comments:
Post a Comment