Monday, August 16, 2010

TO CHECK GIVEN STRING IS PALINDROME OR NOT

0 comments
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[100];
int a,b,c=0,i,j,l;
printf("Enter your string:");
gets(str);
l=strlen(str);
j=l-1;
for(i=0;i<j/2;i++,j--)
{
if(str[i]==str[j])
{
c=1;
}
}
if(c==1)
printf("The string is palindrome");
else
printf("The string is not palindrome");
getch();
}

Leave a Reply