#include<stdio.h>
#include<string.h>
int main()
{
char str1[20];
int i, j, count=0, prove=0;
printf("\nEnter any string: ");
gets(str1);
for (i=0; str1[i]!='\0'; i++)
{
count++;
}
for(i=0,j=count-1;i<count-1;i++,j--)
{
if (str1[i] != str1[j])
{
prove = 1;
break;
}
}
if (prove == 0)
printf("\nString is palindrome");
else
printf("\nString is not palindrome");
return 0;
}
output:
No comments:
Post a Comment