C program for checking Palindrome string without using string function.

IS PALINDROME CHECKING WITHOUT USING <string.h> HEADER FILE???




#include<stdio.h>

int main()
{
  char s1[50],s2[50],s3[50]
;

  int i,j,k,len = 0,flag=0;

  printf("Enter your String: ");

  scanf("%s",s1);

  printf("\n<------ Here, we have copied s1 string to s2 string ----->");

  i=0;

  while(s1[i] != '\0')
  {

    s2[i] = s1[i];

    i++;

  }
  s2[i] = '\0';

  printf("\n Your enterd string is copied to s2 and string is: %s\n",s2);

  printf("\n<------ Here, we have reversed s2 string into s3 string----->");

  i = 0;

  while(s2[i]!='\0')
  {

    len++;
    i++;

  }

  k = len-1;

  for(j = 0; j < len; j++)
  {

    s3[j] = s2[k];
    k--;

  }

  s3[j] 
= '\0';

  printf("\n The reverse string of s2 is stored in s3 and that is : %s\n",s3);

  printf("\n<---- We have compared s1 string and s2 string to check if it is PALINDROME ---->");

  for(i=0,j=0;s1[i]!='\0',s3[j] != '\0';i++,j++)
  {

    if (s1[i] != s3[j])
    {

      flag = 1;
      break;

    } 
  }

  if (flag == 1)
  {

    printf("\n String you entered is Not PALINDROME string\n");

  }

  else
  {

    printf("\n String you entered is PALINDROME string\n");

  }

  printf("\n <----- Your program is ended here----->");

  return 0;

}


INPUT && OUTPUT