check the number is palin drome(using java)

 

// if the reverse of a number is same as original number then the number is palindrome

// ex- a=121  ans -121     a=125 ans -521 is not palindrome

class palindrome

{

public static void main(String args[])

{

int  no=125, rev=0,b=0 copy=no;

while(no>0)

{

b=n0%10;

no=no/10;

rev=rev *10+b;

}

if(copy==rev)

System.out.println("palindrome");

else

System.out.println("not palindrome");

}

}

Comments

Post a Comment

Popular posts from this blog