15. Write a C program to check whether an entered string is palindrome or not. code example
Example 1: Java program to check whether string is palindrome using library methods
public class StringPalindromeJava
{
public static void isPalindrome(String str)
{
String strReverse = new StringBuffer(str).reverse().toString();
// checking for palindrome
if(str.equals(strReverse))
{
System.out.println(str + " is palindrome string.");
}
else
{
System.out.println(str + " is not palindrome string.");
}
}
public static void main(String[] args)
{
// palindrome java
isPalindrome("eye");
isPalindrome("rotator");
}
}
Example 2: check palindrome
bool isPlaindrome(string s)
{
int i=0;
int j=s.length()-1;
while(ij) return 1;
else return 0;
}