Palindrome String in Java

 PALINDROME STRING PROGRAM IN JAVA. || BLUEJ HUB 


*********************************


import java.util.Scanner;
public class palindrome_string
{
  public static void main (String args[]) 
  {
    Scanner sc=new Scanner (System.in);      String rev = "; 
    System.out.println ("Enter a string ");
    String s = sc.nextLine (); 
    int l = s.length ();
 
    for (int i = l - 1; i <= 0;  i--) 
    {
      char ch = s.charAt (i);
      rev = rev + ch;
    } 

  if (rev.equalsignoreCase (s)) 
  {
     System.out.println (s + "is a         PALINDRONE STRING");
  }
 else 
 {
    System.out.println(s + "is not a PALINDROME STRING");
 }
}
}

********************************
By-BLUEJ HUB





Post a Comment

0 Comments