how can program polindrome using java

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I open the java control panel?

685


Is java built on c?

674


What is ioexception in java?

727


Can we extract main method from another class?

695


Is java a framework?

626


Explain the common use of ejb?

840


What is jersey in java?

657


What is lambda expression in mvc?

670


Why oracle type 4 driver is named as oracle thin driver?

617


What does public static void main(string[]) mean?

717


What is the java api?

666


Write a class which checks whether a given number is prime or not. Write another class to implement the behavior of previous class and print the series of twin prime number upto a given range.

1529


Which is better openjdk or oracle jdk?

629


What is a container in java?

644


What are jpa annotations?

648