//!BjueJ :IDE for icse students!
import java.io.*;
class palindrome
{
public static void main(String arg[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int l,i,j,flag=1;
String s;
System.out.println("Enter the string:");
s=in.readLine();
l=s.length();
for(i=0,j=l-1;i<=j;i++,j--)
{
if(s.charAt(i)==s.charAt(j))
{}
else
{
flag=0;
break;
}
}
if(flag==1)
System.out.print(s+" is palindrome");
else
System.out.print(s+" is not palindrome");
}
}
//VISIT http://icse.fairtopic.com for free help
Wednesday, January 23, 2008
JAVA Program to check a String for palindrome
Posted by Blogger 2.o at 11:30 PM
Labels: BLUEJ, BufferedReader, computer icse, computer program, for icse students, india, JAVA, JAVA program, model test paper, palindrome
Subscribe to:
Post Comments (Atom)
2 comments:
thanks dude
Thanks for sharing
Post a Comment