AJ Java Programs
Program 8:
String Palindrome:A String is said to be palindrome if it conveys same meaning when read from front or back
Example MADAM, DAD, MALAYALAM etc
Syntax:
import java.io.*;class str_palin
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,rev="";
System.out.println("Enter a string to reverse It");
s=br.readLine();
s.trim();
int l=s.length();
for(int i=l-1;i>=0;i--)
{
rev=rev+s.charAt(i);
}
if(s.equals(rev))
System.out.println("It is string palindrome");
else{
System.out.println("It is not string palindrome");
}
System.out.println(rev);
}
}
Tested Ok Program
If You Don't Understand anything or want any program please write your request in Comment Section
And Please Like The Post
can you please post an interface program
ReplyDelete