Click the Twitter icon to follow our tweets and
know more about us.

WAP to enter a string and check for pelindrome

//
  class palinsting
  {
      public static void main(String nm)
      {
          String c="";String b="";
          int l=nm.length();
          for(int i=0;i<l;i++)
          {
              char d=nm.charAt(i);
              c=d+c;
              b=b+d;
            }
            if(c.equalsIgnoreCase(b)==true)
            System.out.println("is palindrome");
            else
            System.out.println("Not palindrome");
        }
    }

Comments (0)

Post a Comment