lass Palindrome
{
static boolean checkpalindrome(char[] A)
{
boolean palin=true;
for(int i=0;i<=A.length/2;i++)
{
if (A[i]!=A[A.length-i-1])
{
palin=false;
break;
}
}
return palin;
}
public static void main(String args[])
{
BufferedReader bf=new BufferedReader(new inputStreamReader(System.in));
System.out.print("Enter a word");
String inpStr=bf.readline();
inpStr=inpStr.toUpperCase();
char[] inpass=inpStr.toCharArray();
if(checkpalindrom(inpass))
System.out.print("Yes the string is palindrome");
else
System.out.print("No, the string is not palindrome");
}
}
//i get 4 errors and dont know the problem can anyone help me
This post has been edited by JackOfAllTrades: 10 July 2011 - 07:55 AM
Reason for edit:: Added code tags

New Topic/Question
Reply




MultiQuote








|