Write a java program that checks whether a given NUMBER is palindrome or not.
import java.io.*;
public class Palindromenumber
{
public static void main(String args[])throws IOException
{
DataInputStream din=new DataInputStream(System.in);
int num,remainder,result=0,n;
System.out.println("Enter the number:");
String s=din.readLine();num = Integer.parseInt(s);
n=num;
while(num>0)
{
remainder = num%10;result = result * 10 + remainder;num = num/10;
}
if(n==result)
{
System.out.println(n+"is palindrome" );
}else
{
System.out.println(n+" is not palindrome" );
}
}
}
Wednesday, January 23, 2008
Write a java program that checks whether a given NUMBER is palindrome or not.
Posted by Blogger 2.o at 11:59 PM
Labels: BLUEJ, computer icse, computer program, for icse students, icse, ICSE 2008 Exam, isc, JAVA, JAVA program, JAVA related questions, model test paper, palindrome
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment