write program for palindrome

Answer Posted / devunegi.negi

write program for palindrome in jdk........


import java.i.*;

class palindroame

{
public static void main(String args[])throws IEXception

int n,s,rev,m;
n=s
BufferedReader br =new BufferedReader(new InputStreamReader
(System.in));

System.out.println("Enter the Digit=");
s=Integer.parseInt(br.readLine());

While(s!=0)

{
m=s%10;

rev=(10*rev)+m;
s=s/10;
}
if(rev==n)
System.out.println("This number is Palindrome");

else
System.out.println("This number is Not palindrome");
}

Is This Answer Correct ?    13 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of c++? Explain

773


To what does “event-driven” refer?

802


How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?

761


What is abstraction in c++ with example?

757


Differences between private, protected and public and give examples.

744






What is size_type?

705


What does new do in c++?

807


What are the benefits of operator overloading?

873


When is the destructor called?

764


What is the purpose of templates in c++?

749


What is #include ctype h in c++?

855


In what situations do you have to use initialization list rather than assignment in constructors?

814


In a function declaration what does extern means?

784


What is the need of a destructor?

845


What is a block in c++?

765