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 is the difference between the functions memmove() and memcpy()?

642


How to tokenize a string in c++?

616


Define a nested class. Explain how it can be useful.

646


What c++ is used for?

594


what is pre-processor in C++?

603






What is the difference between the indirection operator and the address of oper-ator?

614


What is the benefit of encapsulation?

602


What is the use of namespace std in C++?

628


Out of fgets() and gets() which function is safe to use?

649


How many types of modularization are there in c++?

569


What are friend classes?

617


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

728


What is the use of data hiding?

607


How did c++ start?

622


Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

595