/*program to find palindrome of a string*/
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,len,flag=1;
char string[100];
gets(string);
len=strlen(string);
for(i=0,j=len;i<(len/2);i++,j--)
{
if(string[i]!=string[j-1])
flag=0;
}
if(flag==1)
printf("Palindrome");
else
printf("Not palindrome");
return 0;
}
No comments:
Post a Comment