{
static boolean palindrome(String s)
{
String s1="";
int i, flag=0;
for(i=s.length()-1;i>=0;i--)
{
s1=s1+s.charAt(i);
}
for(i=0;i
if (s.charAt(i)!=s1.charAt(i))
flag =1;
}
if(flag==1)
return false;
else
return true;
}
public static void main(String args[])
{
String s="madam";
boolean b=palindrome(s);
System.out.println(b);
}
}
No comments:
Post a Comment