how can program polindrome using java



how can program polindrome using java..

Answer / mahesh

import java.lang.*;
class Plindrome
{
public static void main(String arg[])
{
int n=121,m;
int rev,rem;
rev=0;m=n;
while(n>0)
{
rem=n%10;
rev=rev*10+rem;
n=n/10;
}
if(m==rev)
{
System.out.println("palindrome",+rev);
}
else
{
System.out.println("not palindrome",+rev);
}
}
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

what is the package for freshers in valuelabs.

0 Answers  


What is dependency injection in java?

0 Answers  


why the sleep method does not leave the lock and wait method leave the lock

4 Answers  


What is Map,List,hashtable,ArrayList and difference between them??

0 Answers   Cap Gemini, TCS,


What is exe file in java?

0 Answers  






What is java ioc?

0 Answers  


For each of the following program segments,give a big zero analysis for the running time 1.For (i=0;i<m;i++) { // } 2.For (j=0;j<i;j++)

0 Answers   St. Pauls University,


What are orm tools in java?

0 Answers  


Is jar an executable?

0 Answers  


What is web container in java?

0 Answers  


What is transient in java?

0 Answers  


What is the content of the Java 2 security policy file?

1 Answers  


Categories