C program to check word is palindrome or not | C Program to find word is palindrome or not

C program to check word is palindrome or not | C Program to find word is palindrome or not





#include
#include
main()
{
    int i,j=0,k;
    char a[20];
    printf("Enter a word to check whether its a palindrome.\n");
    scanf("%s",a);
    k=strlen(a);
    for (i=0;i<k/2;i++)
    {
        if(a[i]==a[k-i-1])
        ;                  //empty statement.
        else
         {
          j++;
          break;
         }
    }
    if(j>0)
    printf("The word is not palindrome .\n");
    else
    printf("The word is palindrome .\n");
    getch();
}

No comments:

Post a Comment