Search This Blog

Translate

c program to check string palindrome or not

c program to check string palindrome or not

c program to check palindrome string without using library functions


#include
#include
void main()
{
  int i,j,chk=0;
  char s1[20];
  clrscr();
  printf("\n Enter string:");
  gets(s1);
   for(i=0,j=strlen(s1)-1;s1[i]==s1[j];i++,j--)
     if(s1[i]==s1[j])
      chk=1;
   if(chk==1)
      printf("\n Given string is palindrome!");
     else
     printf("\n Given string is not palindrome!");


  getch();
}

C Program example List

Google+ Badge