Computer Science, asked by prathambillgates, 5 months ago

Write a program that reads a string and check whether it is a palindrome string or not without any string slice​

Answers

Answered by subbaraop664gmailcom
0

Answer:

string is not a palindrome.

Explanation:

because palindrome means when we reverse also we get same spelling

Answered by ritijoshi01
0

Answer:

public class Palindrome

{

   public static void main(String args[])

   {

       String a, b = "";

       Scanner s = new Scanner(System.in);

       System.out.print("Enter the string you want to check:");

       a = s.nextLine();

       int n = a.length();

       for(int i = n - 1; i >= 0; i--)

       {

           b = b + a.charAt(i);

       }

       if(a.equalsIgnoreCase(b))

       {

           System.out.println("The string is palindrome.");

       }

       else

       {

           System.out.println("The string is not palindrome.");

       }

   }

}

Output:

$ javac Palindrome.java

$ java Palindrome

 

Enter the string you want to check:NeveroddorEVen

The string is palindrome.

Similar questions