#include<stdio.h>
#include<conio.h>
int main( )
{
char str[30];
char *p, *t ;
printf("Enter any string : ");
gets(str) ;
for(p=str; *p!=NULL; p++)
for(t=str; p--; p>=t)
{
if(*p==*t)
{
p-- ;
t++ ;
}
else
break ;
}
if(t>p)
printf("\n\t String is PALINDROME") ;
else
printf("\n\t String is NOT palindrome") ;
return 0;
}
:: Output ::
Enter any string : MADAM
String is PALINDROME
super
ReplyDelete