Palindrome - String

check whether the given string is a palindrome

#include < stdio.h>
#include < conio.h>
#include < string.h>
main()
{
char a[20],b[20]="";
int i,l,j;
clrscr();
printf("ENTER THE STRING:");
gets(a);
l=strlen(a);
for(i=0;i{
b[i]=a[l-i-1];
}
j=strcmp(a,b);
if(j==0)
printf("palindrom");
else
printf("not palindrom");
getch();
}

0 comments: