import
java.lang.*;
class Palindrom
{
public static void main(String args[])
{
String org="madama";
String rev="";
int i,l;
l=org.length();
System.out.println("Original string is "+org);
for(i=l-1;i>=0;i--)
rev+=org.charAt(i);
System.out.println("Reversed string is "+rev);
if(org.equals(rev))
System.out.println("Given string is Palindrom");
else
System.out.println("Given string is Not a Palindrom");
}
}
Output:
|
0 comments:
Post a Comment