Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROGRAM TO CHECK WHETHER THE STRINGS ARE PALINDROME OR NOT
#1

Code:
import java.io.*;
class Dem20
{
  public static void main(String args[])throws IOException
{
  BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
  int i,n=0;
  String s1;
try
  {
  System.out.println("enter the size of array:");

  n=Integer.parseInt(b.readLine());
  String s=new String[n];
  System.out.println("enter the string:");
  for(i=0;i<n;i++)
  {
  s[i]=b.readLine();
  }
  for(i=0;i<n;i++)
  {
  StringBuffer sb=new StringBuffer(s[i]) ;
  s1=new String(sb.reverse());
  if(s[i].equals(s1))
  {
  System.out.println("String is"+s[i]+""+"palindrome");
  }
  else
  {
  System.out.println("String is"+s[i]+""+"not palindrome");
  }
  }

  }
  catch(Exception e)
  {
  System.out.println(e);
  }
  }
}

OUTPUT
E:\3msc\java\meenu>java Dem20
enter the size of array:
3
enter the string:
aba
joby
jiss
String is aba palindrome
String is joby not palindrome
String is jiss snot palindrome
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: lex code in c to check whether the given string is a palindrome or not, lex program to check a word to be palindrome or not, check whether the string is palindrome or not in lex, program to check string is palindrome or not in php, lex program to check number is palindrome or not, lex program to check string is palindrome or not, http seminarprojects org t program to check whether the strings are palindrome or not,

Forum Jump:


Users browsing this thread: 1 Guest(s)