LED PANEL

Google It, You'll Get It.

Monday, January 31, 2011

Palindrome Word checker

What are palindrome Words? http://rinkworks.com/words/palindromes.shtml



#include
main()
{
char word[10], test='T';
int l = 0, i = 0; // l=length

printf("enetr the word : ");
scanf("%s",&word);

//length checkng
for (i=0;word[i]!='\0';i++)
{
l++; // length of the word
}
printf("wrd count %d \n",l);

//check
/* while(i!=l)
{
while( word[i]==word[l-i] )
{
printf("match");
i++;
//j--;
}

}
*/
//checkz
l=i-1;
for(i=0;i<(l/2);i++)
{
if(word[i]!=word[l-i])
test='F';
}

if(test=='T')
printf("Yes");
else
printf("No");
}

No comments:

Post a Comment