#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50];
int i,len,flag=0;
printf("\n Enter the string to check for palindrome");
scanf("%s",str);
len=strlen(str);
for(i=0;i<len;i++)
{
if(str[i]!=str[len-i-1])
{
flag=1;
break;
}
}
if (flag==0)
printf("string is palindrome");
else
printf("string is not a palindrome");
getch();
return 0;
}
Output:
Enter the string to check for palindrome mom
string is palindrome
Enter the string to check for palindrome aryan
string is not a palindrome
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer