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 download and install eclipse on windows 10?

441


What is aop in java?

494


What is reflection in java?

491


How do javabeans work?

477


What is a java singleton?

473






Why bean class is used in java?

449


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. Define how can I implement this logic?

583


What is tight coupling in java?

502


What is data encapsulation?

527


What is the purpose of jdk?

448


Why do we only use the main method to start a program?

489


How can you work with permissions from your .net application? : java security

495


Write a program for the following topic - switch case,looping using fuction calling,nesting,console input output. Aim- to print a menu:- 1-series 2-single value. Each menu having sub menu armstrong or perfect.

1510


Who created eclipse?

479


How do I install java on windows?

465