Palindrome string:
-Palindrome string are those strings which are equal when we traverse string in normal and reverse direction.
Example-
string is "saas"
It is palindrome string
string is "Myhome"
It is not palindrome string
program-
#include< stdio.h>
#include< string.h>
int main()
{
char s1[20],s2[20];
int i=0,len=0;
//input of string
printf("Enter string");
scanf("%s",&s1);
// find length
while(s1[i++]!=' ')
len++;
//Now reverse
i=0;
while(s1[i]!=' ')
{
s2[i]=s1[len-i-1];
i++;
}
if(strcmp(s1,s2))
{
printf("String is not palindrome");
}
else
printf("String is palindrome");
}
Enter string
12321
String is palindrome
Enter string
Mystring
String is not palindrome